Bogus and missed folding on vector compares
commit6b32400e19a702137fd11571d199f725add0daf6
authorRichard Biener <rguenther@suse.de>
Fri, 23 Jun 2023 08:15:27 +0000 (23 10:15 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 23 Jun 2023 09:22:38 +0000 (23 11:22 +0200)
treefb06add493b48a8bbe7d67bb6c649739cb5d18c5
parentefc7fadff587b675552cd130cffe8c96c0feb4fc
Bogus and missed folding on vector compares

fold_binary tries to transform (double)float1 CMP (double)float2
into float1 CMP float2 but ends up using TYPE_PRECISION on the
argument types.  For vector types that compares the number of
lanes which should be always equal (so it's harmless as to
not generating wrong code).  The following instead properly
uses element_precision.

The same happens in the corresponding match.pd pattern.

* fold-const.cc (fold_binary_loc): Use element_precision
when trying (double)float1 CMP (double)float2 to
float1 CMP float2 simplification.
* match.pd: Likewise.
gcc/fold-const.cc
gcc/match.pd