[llvm] d2b8acc - [RISCV] Swap the order of SEWGreaterThanOrEqualAndLessThan64 and SEWGreaterThanOrEqual. (#120649)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 20 11:26:21 PST 2024
Author: Craig Topper
Date: 2024-12-20T11:26:19-08:00
New Revision: d2b8acc10464e1f0f6e043f1a92cefc2f3b9d30f
URL: https://github.com/llvm/llvm-project/commit/d2b8acc10464e1f0f6e043f1a92cefc2f3b9d30f
DIFF: https://github.com/llvm/llvm-project/commit/d2b8acc10464e1f0f6e043f1a92cefc2f3b9d30f.diff
LOG: [RISCV] Swap the order of SEWGreaterThanOrEqualAndLessThan64 and SEWGreaterThanOrEqual. (#120649)
SEWGreaterThanOrEqualAndLessThan64 is a stricter constraint so it should
have a higher value than SEWGreaterThanOrEqual.
Found by our random test generator.
Added:
llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-zve64f.mir
Modified:
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 49c2bc90c085ab..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.
- SEWGreaterThanOrEqual = 2, // SEW can be changed as long as it's greater
- // than or equal to the original value.
+ SEWEqual = 3, // The exact value of SEW needs to be preserved.
SEWGreaterThanOrEqualAndLessThan64 =
- 1, // SEW can be changed as long as it's greater
- // than or equal to the original value, but must be less
- // than 64.
- SEWNone = 0 // We don't need to preserve SEW at all.
+ 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 {
LMULEqual = 2, // The exact value of LMUL needs to be preserved.
diff --git a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-zve64f.mir b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-zve64f.mir
new file mode 100644
index 00000000000000..f65bba1b7b9c7e
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-zve64f.mir
@@ -0,0 +1,40 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
+# RUN: llc %s -mtriple=riscv64 -mattr=+zve64f -run-pass=riscv-insert-vsetvli -o - | FileCheck %s
+
+---
+name: spam
+tracksRegLiveness: true
+noPhis: true
+isSSA: false
+body: |
+ bb.0.entry:
+ liveins: $x10, $x11, $x12, $f10_f
+
+ ; CHECK-LABEL: name: spam
+ ; CHECK: liveins: $x10, $x11, $x12, $f10_f
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x12
+ ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
+ ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $x10
+ ; CHECK-NEXT: [[COPY3:%[0-9]+]]:fpr32 = COPY $f10_f
+ ; CHECK-NEXT: dead $x0 = PseudoVSETIVLI 8, 208 /* e32, m1, ta, ma */, implicit-def $vl, implicit-def $vtype
+ ; CHECK-NEXT: renamable $v10 = PseudoVFMV_S_FPR32 undef renamable $v10, [[COPY3]], 8, 5 /* e32 */, implicit $vl, implicit $vtype
+ ; CHECK-NEXT: renamable $v11 = PseudoVMV_S_X undef renamable $v11, [[COPY2]], 8, 5 /* e32 */, implicit $vl, implicit $vtype
+ ; CHECK-NEXT: dead $x0 = PseudoVSETIVLI 1, 216 /* e64, m1, ta, ma */, implicit-def $vl, implicit-def $vtype
+ ; CHECK-NEXT: renamable $v8 = PseudoVLE64_V_M1 undef renamable $v8, [[COPY1]], 1, 6 /* e64 */, 2 /* tu, ma */, implicit $vl, implicit $vtype :: (load unknown-size, align 8)
+ ; CHECK-NEXT: dead $x0 = PseudoVSETIVLI 8, 208 /* e32, m1, ta, ma */, implicit-def $vl, implicit-def $vtype
+ ; CHECK-NEXT: renamable $v9 = PseudoVLE32_V_M1 undef renamable $v9, [[COPY]], 8, 5 /* e32 */, 2 /* tu, ma */, implicit $vl, implicit $vtype :: (load unknown-size, align 4)
+ ; CHECK-NEXT: INLINEASM &"# use $0 $1 $2 $3", 1 /* sideeffect attdialect */, 3145737 /* reguse:VR */, killed renamable $v10, 3145737 /* reguse:VR */, killed renamable $v11, 3145737 /* reguse:VR */, killed renamable $v8, 3145737 /* reguse:VR */, killed renamable $v9
+ ; CHECK-NEXT: PseudoRET
+ %3:gpr = COPY $x12
+ %2:gpr = COPY $x11
+ %1:gpr = COPY $x10
+ %0:fpr32 = COPY $f10_f
+ renamable $v10 = PseudoVFMV_S_FPR32 undef renamable $v10, %0, 8, 5 /* e32 */
+ renamable $v11 = PseudoVMV_S_X undef renamable $v11, %1, 8, 5 /* e32 */
+ renamable $v8 = PseudoVLE64_V_M1 undef renamable $v8, %2, 1, 6 /* e64 */, 2 /* tu, ma */ :: (load unknown-size, align 8)
+ renamable $v9 = PseudoVLE32_V_M1 undef renamable $v9, %3, 8, 5 /* e32 */, 2 /* tu, ma */ :: (load unknown-size, align 4)
+ INLINEASM &"# use $0 $1 $2 $3", 1 /* sideeffect attdialect */, 3145737 /* reguse:VR */, killed renamable $v10, 3145737 /* reguse:VR */, killed renamable $v11, 3145737 /* reguse:VR */, killed renamable $v8, 3145737 /* reguse:VR */, killed renamable $v9
+ PseudoRET
+
+...
More information about the llvm-commits
mailing list