[llvm] [AMDGPU] Fix legalization of frem(-0.0, y) (PR #70448)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 05:16:35 PDT 2023


================
@@ -29,7 +29,10 @@ define amdgpu_kernel void @frem_f16(ptr addrspace(1) %out, ptr addrspace(1) %in1
 ; CI-NEXT:    s_mov_b32 s7, 0xf000
 ; CI-NEXT:    v_div_fixup_f32 v2, v2, v1, v0
 ; CI-NEXT:    v_trunc_f32_e32 v2, v2
-; CI-NEXT:    v_fma_f32 v0, -v2, v1, v0
+; CI-NEXT:    v_fma_f32 v1, -v2, v1, v0
+; CI-NEXT:    v_and_b32_e32 v1, 0x7fffffff, v1
+; CI-NEXT:    v_and_b32_e32 v0, 0x80000000, v0
+; CI-NEXT:    v_or_b32_e32 v0, v1, v0
----------------
jayfoad wrote:

Note that the fix is applied here in `frem_f16` and in `unsafe_frem_f16` but not in `fast_frem_f16`.

https://github.com/llvm/llvm-project/pull/70448


More information about the llvm-commits mailing list