[llvm] AMDGPU: Add tonearest and towardzero roundings for intrinsic llvm.fptrunc.round (PR #104486)
Changpeng Fang via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 12:33:26 PDT 2024
================
@@ -23,6 +32,16 @@ define amdgpu_gs half @v_fptrunc_round_f32_to_f16_downward(float %a) {
ret half %res
}
+define amdgpu_gs half @v_fptrunc_round_f32_to_f16_towardzero(float %a) {
+; CHECK-LABEL: v_fptrunc_round_f32_to_f16_towardzero:
+; CHECK: ; %bb.0:
+; CHECK-NEXT: s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2), 3
+; CHECK-NEXT: v_cvt_f16_f32_e32 v0, v0
+; CHECK-NEXT: ; return to shader part epilog
+ %res = call half @llvm.fptrunc.round.f16.f32(float %a, metadata !"round.towardzero")
+ ret half %res
+}
+
----------------
changpeng wrote:
Add tests that has multiple calls with round.towardzero and round.downward.
https://github.com/llvm/llvm-project/pull/104486
More information about the llvm-commits
mailing list