The following fixes the RTL folder to not consider a vector FP division of 0.0 as 0.0.
Bootstrap and regtest on x86_64-unknown-linux-gnu pending. Any way to test, in the testcase, whether the vector modes will have NaNs or not? Richard. 2011-12-22 Richard Guenther <rguent...@suse.de> PR rtl-optimization/50396 * simplify-rtx.c (simplify_binary_operation_1): Properly guard code that only works for integers. * gcc.dg/torture/pr50396.c: New testcase. Index: gcc/simplify-rtx.c =================================================================== --- gcc/simplify-rtx.c (revision 182624) +++ gcc/simplify-rtx.c (working copy) @@ -2953,7 +2953,7 @@ simplify_binary_operation_1 (enum rtx_co } } } - else + else if (SCALAR_INT_MODE_P (mode)) { /* 0/x is 0 (or x&0 if x has side-effects). */ if (trueop0 == CONST0_RTX (mode) Index: gcc/testsuite/gcc.dg/torture/pr50396.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr50396.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr50396.c (revision 0) @@ -0,0 +1,17 @@ +/* { dg-do run } */ + +extern void abort (void); +typedef float vf128 __attribute__((vector_size(16))); +typedef float vf64 __attribute__((vector_size(8))); +int main() +{ + vf128 v = (vf128){ 0.f, 0.f, 0.f, 0.f }; + vf64 u = (vf64){ 0.f, 0.f }; + v = v / (vf128){ 0.f, 0.f, 0.f, 0.f }; + if (v[0] == 0.f) + abort (); + u = u / (vf64){ 0.f, 0.f }; + if (u[0] == 0.f) + abort (); + return 0; +}