[llvm] [RISCV] Swap the order of SEWGreaterThanOrEqualAndLessThan64 and SEWGreaterThanOrEqual. (PR #120649)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 15:48:51 PST 2024


https://github.com/topperc updated https://github.com/llvm/llvm-project/pull/120649

>From abee03070d61a4bc2e785dca287a295fa60d2f50 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 19 Dec 2024 15:36:28 -0800
Subject: [PATCH 1/2] [RISCV] Swap the order of
 SEWGreaterThanOrEqualAndLessThan64 and SEWGreaterThanOrEqual.

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.
---
 llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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 {

>From f28592bb9d377a7e03e510db58d6c248802a1b92 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 19 Dec 2024 15:48:37 -0800
Subject: [PATCH 2/2] fixup! clang-format

---
 llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 55f2742edf38e3..75985832594d45 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -218,14 +218,14 @@ struct DemandedFields {
   bool VLZeroness = false;
   // What properties of SEW we need to preserve.
   enum : uint8_t {
-    SEWEqual = 3,              // The exact value of SEW needs to be preserved.
+    SEWEqual = 3, // The exact value of SEW needs to be preserved.
     SEWGreaterThanOrEqualAndLessThan64 =
-        2,      // SEW can be changed as long as it's greater
-                // than or equal to the original value, but must be less
-                // than 64.
+        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.
+    SEWNone = 0                // We don't need to preserve SEW at all.
   } SEW = SEWNone;
   enum : uint8_t {
     LMULEqual = 2, // The exact value of LMUL needs to be preserved.



More information about the llvm-commits mailing list