Message ID | 91ad08f6bdab72e72c606211a2b0803399382e72.1529404593.git.segher@kernel.crashing.org |
---|---|
State | New |
Headers | show |
Series | rs6000: Fix vector homogeneous aggregates (PR86197) | expand |
On Tue, Jun 19, 2018 at 10:45:59AM +0000, Segher Boessenkool wrote: > The existing code allows only 4 vectors worth of ieee128 homogeneous > aggregates, but it should be 8. This happens because at one spot it > is mistakenly qualified as being passed in floating point registers. > > This patch fixes it and makes the code easier to read. Committing to > trunk; needs backports too. Backported to 8 now. Segher
On Mon, Jun 25, 2018 at 06:32:27AM -0500, Segher Boessenkool wrote: > On Tue, Jun 19, 2018 at 10:45:59AM +0000, Segher Boessenkool wrote: > > The existing code allows only 4 vectors worth of ieee128 homogeneous > > aggregates, but it should be 8. This happens because at one spot it > > is mistakenly qualified as being passed in floating point registers. > > > > This patch fixes it and makes the code easier to read. Committing to > > trunk; needs backports too. > > Backported to 8 now. And to 7 and 6. Segher
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 307c88e..78f6ffe 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -10867,12 +10867,12 @@ rs6000_discover_homogeneous_aggregate (machine_mode mode, const_tree type, if (field_count > 0) { - int n_regs = (SCALAR_FLOAT_MODE_P (field_mode) ? - (GET_MODE_SIZE (field_mode) + 7) >> 3 : 1); + int reg_size = ALTIVEC_OR_VSX_VECTOR_MODE (field_mode) ? 16 : 8; + int field_size = ROUND_UP (GET_MODE_SIZE (field_mode), reg_size); /* The ELFv2 ABI allows homogeneous aggregates to occupy up to AGGR_ARG_NUM_REG registers. */ - if (field_count * n_regs <= AGGR_ARG_NUM_REG) + if (field_count * field_size <= AGGR_ARG_NUM_REG * reg_size) { if (elt_mode) *elt_mode = field_mode;