AMDGPU: Fold fneg into bitcast of build_vector
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 26 Jan 2023 19:46:00 +0000 (15:46 -0400)
committerMatt Arsenault <arsenm2@gmail.com>
Tue, 11 Apr 2023 11:12:01 +0000 (07:12 -0400)
commit0f59720e1c3416030a91fdfb6f016fd7fdf21e85
tree7ab69efc177bff161f65b23ae84e95420385e335
parent727ebefecb3dbb570b15d6f4242d4de61d2307ff
AMDGPU: Fold fneg into bitcast of build_vector

The math libraries have a lot of code that performs
manual sign bit operations by bitcasting doubles to int2
and doing bithacking on them. This is a bad canonical form
we should rewrite to use high level sign operations directly
on double. To avoid codegen regressions, we need to do a better
job moving fnegs to operate only on the high 32-bits.

This is only halfway to fixing the real case.
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/test/CodeGen/AMDGPU/fneg-combines.new.ll
llvm/test/CodeGen/AMDGPU/fneg-modifier-casting.ll