-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AMDGPU: Pre-commit test to verify mode change in fp constrained operations #88858
Conversation
This test will check the mode register in case of constrained floating point operations.
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-backend-amdgpu Author: Abhinav Garg (abhigargrepo) ChangesThis test will check the mode register in case of constrained floating point operations. Full diff: https://github.com/llvm/llvm-project/pull/88858.diff 1 Files Affected:
diff --git a/llvm/test/CodeGen/AMDGPU/mode-register-fpconstrain.mir b/llvm/test/CodeGen/AMDGPU/mode-register-fpconstrain.mir
new file mode 100644
index 00000000000000..fe4912c2e84cf6
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/mode-register-fpconstrain.mir
@@ -0,0 +1,36 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=si-mode-register -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
+
+# The si-mode-register pass is changing the default mode for FP constrained operations.
+# It must ignore strictfp functions.
+
+--- |
+ define void @ignoreStrictFpFns() #0 {
+ ret void
+ }
+
+ attributes #0 = { strictfp }
+
+...
+---
+name: ignoreStrictFpFns
+tracksRegLiveness: true
+body: |
+ bb.0:
+ liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
+ ; GCN-LABEL: name: ignoreStrictFpFns
+ ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
+ ; GCN-NEXT: {{ $}}
+ ; GCN-NEXT: S_WAITCNT 0
+ ; GCN-NEXT: S_SETREG_IMM32_B32_mode 1, 2177, implicit-def dead $mode, implicit $mode
+ ; GCN-NEXT: S_SETREG_IMM32_B32 0, 129, implicit-def $mode, implicit $mode
+ ; GCN-NEXT: renamable $vgpr0_vgpr1 = nofpexcept V_ADD_F64_e64 0, killed $vgpr0_vgpr1, 0, killed $vgpr2_vgpr3, 0, 0, implicit $mode, implicit $exec
+ ; GCN-NEXT: S_SETREG_IMM32_B32_mode 0, 2177, implicit-def dead $mode, implicit $mode
+ ; GCN-NEXT: S_SETPC_B64_return undef $sgpr30_sgpr31, implicit killed $vgpr0, implicit killed $vgpr1
+ S_WAITCNT 0
+ S_SETREG_IMM32_B32_mode 1, 2177, implicit-def dead $mode, implicit $mode
+ renamable $vgpr0_vgpr1 = nofpexcept V_ADD_F64_e64 0, killed $vgpr0_vgpr1, 0, killed $vgpr2_vgpr3, 0, 0, implicit $mode, implicit $exec
+ S_SETREG_IMM32_B32_mode 0, 2177, implicit-def dead $mode, implicit $mode
+ S_SETPC_B64_return undef $sgpr30_sgpr31, implicit killed $vgpr0, implicit killed $vgpr1
+
+...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be an IR test. Commit message should also be more specific
This test will check the mode register change in case of constrained floating point operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch title should be made more specific for what this is a test for
This test will check the mode register change in case of constrained floating point operations.
This test will check the mode register change in case of constrained floating point operations.
; GCN-NEXT: v_add_f64 v[0:1], v[0:1], v[2:3] | ||
; GCN-NEXT: s_setpc_b64 s[30:31] | ||
entry: | ||
call void @llvm.set.fpenv.i64(i64 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the most realistic source value but ok
@abhigargrepo Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
This test will check the mode register in case of constrained floating point operations.