Skip to content

[RISCV] Swap the order of SEWGreaterThanOrEqualAndLessThan64 and SEWGreaterThanOrEqual. #120649

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

Merged
merged 4 commits into from
Dec 20, 2024

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Dec 19, 2024

SEWGreaterThanOrEqualAndLessThan64 is a stricter constraint so it should have a higher value than SEWGreaterThanOrEqual.

Found by our random test generator. I don't have a test case yet.

@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2024

@llvm/pr-subscribers-backend-risc-v

Author: Craig Topper (topperc)

Changes

SEWGreaterThanOrEqualAndLessThan64 is a stricter constraint so it should have a higher value than SEWGreaterThanOrEqual.

Found by our random test generator. I don't have a test case yet.


Full diff: https://github.com/llvm/llvm-project/pull/120649.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp (+3-3)
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 49c2bc90c085ab..55f2742edf38e3 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -219,12 +219,12 @@ struct DemandedFields {
   // What properties of SEW we need to preserve.
   enum : uint8_t {
     SEWEqual = 3,              // The exact value of SEW needs to be preserved.
-    SEWGreaterThanOrEqual = 2, // SEW can be changed as long as it's greater
-                               // than or equal to the original value.
     SEWGreaterThanOrEqualAndLessThan64 =
-        1,      // SEW can be changed as long as it's greater
+        2,      // SEW can be changed as long as it's greater
                 // than or equal to the original value, but must be less
                 // than 64.
+    SEWGreaterThanOrEqual = 1, // SEW can be changed as long as it's greater
+                               // than or equal to the original value.
     SEWNone = 0 // We don't need to preserve SEW at all.
   } SEW = SEWNone;
   enum : uint8_t {

Copy link

github-actions bot commented Dec 19, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

…reaterThanOrEqual.

SEWGreaterThanOrEqualAndLessThan64 is a stricter constraint so
it should have a higher value than SEWGreaterThanOrEqual.

Found by our random test generator. I don't have a test case yet.
@topperc topperc force-pushed the pr/zve64f-sew-priority branch from f28592b to 1f65f12 Compare December 20, 2024 04:42
Copy link
Collaborator

@preames preames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - good find, that's a nasty bug.

@topperc topperc merged commit d2b8acc into llvm:main Dec 20, 2024
8 checks passed
@topperc topperc deleted the pr/zve64f-sew-priority branch December 20, 2024 19:26
qiaojbao pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Feb 7, 2025
Local branch amd-gfx f899220 Merged main:8c0090030bf8 into amd-gfx:4088678579a3
Remote branch main d2b8acc [RISCV] Swap the order of SEWGreaterThanOrEqualAndLessThan64 and SEWGreaterThanOrEqual. (llvm#120649)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants