[llvm] 8dca521 - [AArch64] Pre-commit multi use shift amount tests for D77316
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 11 00:27:38 PST 2022
Author: Jay Foad
Date: 2022-02-11T08:23:33Z
New Revision: 8dca5217dcdd303ad694f8c4a1cb8d4616bbf8c2
URL: https://github.com/llvm/llvm-project/commit/8dca5217dcdd303ad694f8c4a1cb8d4616bbf8c2
DIFF: https://github.com/llvm/llvm-project/commit/8dca5217dcdd303ad694f8c4a1cb8d4616bbf8c2.diff
LOG: [AArch64] Pre-commit multi use shift amount tests for D77316
Differential Revision: https://reviews.llvm.org/D119423
Added:
Modified:
llvm/test/CodeGen/AArch64/shift-amount-mod.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/AArch64/shift-amount-mod.ll b/llvm/test/CodeGen/AArch64/shift-amount-mod.ll
index 7971a77e68dae..31eddbf871db7 100644
--- a/llvm/test/CodeGen/AArch64/shift-amount-mod.ll
+++ b/llvm/test/CodeGen/AArch64/shift-amount-mod.ll
@@ -56,6 +56,24 @@ define void @modify32_shl_by_negated(i32* %valptr, i32 %shamt) nounwind {
store i32 %shifted, i32* %valptr
ret void
}
+define void @modify32_shl_by_negated_multi_use(i32* %valptr, i32 %shamt, i32* %shamtptr) nounwind {
+; CHECK-LABEL: modify32_shl_by_negated_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: neg w8, w1
+; CHECK-NEXT: ldr w9, [x0]
+; CHECK-NEXT: mov w10, #32
+; CHECK-NEXT: lsl w8, w9, w8
+; CHECK-NEXT: sub w9, w10, w1
+; CHECK-NEXT: str w8, [x0]
+; CHECK-NEXT: str w9, [x2]
+; CHECK-NEXT: ret
+ %val = load i32, i32* %valptr
+ %negshamt = sub i32 32, %shamt
+ %shifted = shl i32 %val, %negshamt
+ store i32 %shifted, i32* %valptr
+ store i32 %negshamt, i32* %shamtptr
+ ret void
+}
define i64 @reg64_shl_by_negated(i64 %val, i64 %shamt) nounwind {
; CHECK-LABEL: reg64_shl_by_negated:
@@ -105,6 +123,24 @@ define void @modify64_shl_by_negated(i64* %valptr, i64 %shamt) nounwind {
store i64 %shifted, i64* %valptr
ret void
}
+define void @modify64_shl_by_negated_multi_use(i64* %valptr, i64 %shamt, i64* %shamtptr) nounwind {
+; CHECK-LABEL: modify64_shl_by_negated_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: neg x8, x1
+; CHECK-NEXT: ldr x9, [x0]
+; CHECK-NEXT: mov w10, #64
+; CHECK-NEXT: lsl x8, x9, x8
+; CHECK-NEXT: sub x9, x10, x1
+; CHECK-NEXT: str x8, [x0]
+; CHECK-NEXT: str x9, [x2]
+; CHECK-NEXT: ret
+ %val = load i64, i64* %valptr
+ %negshamt = sub i64 64, %shamt
+ %shifted = shl i64 %val, %negshamt
+ store i64 %shifted, i64* %valptr
+ store i64 %negshamt, i64* %shamtptr
+ ret void
+}
; logical shift right
;------------------------------------------------------------------------------;
@@ -157,6 +193,24 @@ define void @modify32_lshr_by_negated(i32* %valptr, i32 %shamt) nounwind {
store i32 %shifted, i32* %valptr
ret void
}
+define void @modify32_lshr_by_negated_multi_use(i32* %valptr, i32 %shamt, i32* %shamtptr) nounwind {
+; CHECK-LABEL: modify32_lshr_by_negated_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: neg w8, w1
+; CHECK-NEXT: ldr w9, [x0]
+; CHECK-NEXT: mov w10, #32
+; CHECK-NEXT: lsr w8, w9, w8
+; CHECK-NEXT: sub w9, w10, w1
+; CHECK-NEXT: str w8, [x0]
+; CHECK-NEXT: str w9, [x2]
+; CHECK-NEXT: ret
+ %val = load i32, i32* %valptr
+ %negshamt = sub i32 32, %shamt
+ %shifted = lshr i32 %val, %negshamt
+ store i32 %shifted, i32* %valptr
+ store i32 %negshamt, i32* %shamtptr
+ ret void
+}
define i64 @reg64_lshr_by_negated(i64 %val, i64 %shamt) nounwind {
; CHECK-LABEL: reg64_lshr_by_negated:
@@ -206,6 +260,24 @@ define void @modify64_lshr_by_negated(i64* %valptr, i64 %shamt) nounwind {
store i64 %shifted, i64* %valptr
ret void
}
+define void @modify64_lshr_by_negated_multi_use(i64* %valptr, i64 %shamt, i64* %shamtptr) nounwind {
+; CHECK-LABEL: modify64_lshr_by_negated_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: neg x8, x1
+; CHECK-NEXT: ldr x9, [x0]
+; CHECK-NEXT: mov w10, #64
+; CHECK-NEXT: lsr x8, x9, x8
+; CHECK-NEXT: sub x9, x10, x1
+; CHECK-NEXT: str x8, [x0]
+; CHECK-NEXT: str x9, [x2]
+; CHECK-NEXT: ret
+ %val = load i64, i64* %valptr
+ %negshamt = sub i64 64, %shamt
+ %shifted = lshr i64 %val, %negshamt
+ store i64 %shifted, i64* %valptr
+ store i64 %negshamt, i64* %shamtptr
+ ret void
+}
; arithmetic shift right
;------------------------------------------------------------------------------;
@@ -258,6 +330,24 @@ define void @modify32_ashr_by_negated(i32* %valptr, i32 %shamt) nounwind {
store i32 %shifted, i32* %valptr
ret void
}
+define void @modify32_ashr_by_negated_multi_use(i32* %valptr, i32 %shamt, i32* %shamtptr) nounwind {
+; CHECK-LABEL: modify32_ashr_by_negated_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: neg w8, w1
+; CHECK-NEXT: ldr w9, [x0]
+; CHECK-NEXT: mov w10, #32
+; CHECK-NEXT: asr w8, w9, w8
+; CHECK-NEXT: sub w9, w10, w1
+; CHECK-NEXT: str w8, [x0]
+; CHECK-NEXT: str w9, [x2]
+; CHECK-NEXT: ret
+ %val = load i32, i32* %valptr
+ %negshamt = sub i32 32, %shamt
+ %shifted = ashr i32 %val, %negshamt
+ store i32 %shifted, i32* %valptr
+ store i32 %negshamt, i32* %shamtptr
+ ret void
+}
define i64 @reg64_ashr_by_negated(i64 %val, i64 %shamt) nounwind {
; CHECK-LABEL: reg64_ashr_by_negated:
@@ -307,6 +397,24 @@ define void @modify64_ashr_by_negated(i64* %valptr, i64 %shamt) nounwind {
store i64 %shifted, i64* %valptr
ret void
}
+define void @modify64_ashr_by_negated_multi_use(i64* %valptr, i64 %shamt, i64* %shamtptr) nounwind {
+; CHECK-LABEL: modify64_ashr_by_negated_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: neg x8, x1
+; CHECK-NEXT: ldr x9, [x0]
+; CHECK-NEXT: mov w10, #64
+; CHECK-NEXT: asr x8, x9, x8
+; CHECK-NEXT: sub x9, x10, x1
+; CHECK-NEXT: str x8, [x0]
+; CHECK-NEXT: str x9, [x2]
+; CHECK-NEXT: ret
+ %val = load i64, i64* %valptr
+ %negshamt = sub i64 64, %shamt
+ %shifted = ashr i64 %val, %negshamt
+ store i64 %shifted, i64* %valptr
+ store i64 %negshamt, i64* %shamtptr
+ ret void
+}
;==============================================================================;
; the shift amount is complemented (shiftbitwidth - 1 - shiftamt)
@@ -367,6 +475,23 @@ define void @modify32_shl_by_complemented(i32* %valptr, i32 %shamt) nounwind {
store i32 %shifted, i32* %valptr
ret void
}
+define void @modify32_shl_by_complemented_multi_use(i32* %valptr, i32 %shamt, i32* %shamtptr) nounwind {
+; CHECK-LABEL: modify32_shl_by_complemented_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov w8, #31
+; CHECK-NEXT: ldr w9, [x0]
+; CHECK-NEXT: sub w8, w8, w1
+; CHECK-NEXT: lsl w9, w9, w8
+; CHECK-NEXT: str w9, [x0]
+; CHECK-NEXT: str w8, [x2]
+; CHECK-NEXT: ret
+ %val = load i32, i32* %valptr
+ %negshamt = sub i32 31, %shamt
+ %shifted = shl i32 %val, %negshamt
+ store i32 %shifted, i32* %valptr
+ store i32 %negshamt, i32* %shamtptr
+ ret void
+}
define i64 @reg64_shl_by_complemented(i64 %val, i64 %shamt) nounwind {
; CHECK-LABEL: reg64_shl_by_complemented:
@@ -420,6 +545,23 @@ define void @modify64_shl_by_complemented(i64* %valptr, i64 %shamt) nounwind {
store i64 %shifted, i64* %valptr
ret void
}
+define void @modify64_shl_by_complemented_multi_use(i64* %valptr, i64 %shamt, i64* %shamtptr) nounwind {
+; CHECK-LABEL: modify64_shl_by_complemented_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov w8, #63
+; CHECK-NEXT: ldr x9, [x0]
+; CHECK-NEXT: sub x8, x8, x1
+; CHECK-NEXT: lsl x9, x9, x8
+; CHECK-NEXT: str x9, [x0]
+; CHECK-NEXT: str x8, [x2]
+; CHECK-NEXT: ret
+ %val = load i64, i64* %valptr
+ %negshamt = sub i64 63, %shamt
+ %shifted = shl i64 %val, %negshamt
+ store i64 %shifted, i64* %valptr
+ store i64 %negshamt, i64* %shamtptr
+ ret void
+}
; logical shift right
;------------------------------------------------------------------------------;
@@ -476,6 +618,23 @@ define void @modify32_lshr_by_complemented(i32* %valptr, i32 %shamt) nounwind {
store i32 %shifted, i32* %valptr
ret void
}
+define void @modify32_lshr_by_complemented_multi_use(i32* %valptr, i32 %shamt, i32* %shamtptr) nounwind {
+; CHECK-LABEL: modify32_lshr_by_complemented_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov w8, #31
+; CHECK-NEXT: ldr w9, [x0]
+; CHECK-NEXT: sub w8, w8, w1
+; CHECK-NEXT: lsr w9, w9, w8
+; CHECK-NEXT: str w9, [x0]
+; CHECK-NEXT: str w8, [x2]
+; CHECK-NEXT: ret
+ %val = load i32, i32* %valptr
+ %negshamt = sub i32 31, %shamt
+ %shifted = lshr i32 %val, %negshamt
+ store i32 %shifted, i32* %valptr
+ store i32 %negshamt, i32* %shamtptr
+ ret void
+}
define i64 @reg64_lshr_by_complemented(i64 %val, i64 %shamt) nounwind {
; CHECK-LABEL: reg64_lshr_by_complemented:
@@ -529,6 +688,23 @@ define void @modify64_lshr_by_complemented(i64* %valptr, i64 %shamt) nounwind {
store i64 %shifted, i64* %valptr
ret void
}
+define void @modify64_lshr_by_complemented_multi_use(i64* %valptr, i64 %shamt, i64* %shamtptr) nounwind {
+; CHECK-LABEL: modify64_lshr_by_complemented_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov w8, #63
+; CHECK-NEXT: ldr x9, [x0]
+; CHECK-NEXT: sub x8, x8, x1
+; CHECK-NEXT: lsr x9, x9, x8
+; CHECK-NEXT: str x9, [x0]
+; CHECK-NEXT: str x8, [x2]
+; CHECK-NEXT: ret
+ %val = load i64, i64* %valptr
+ %negshamt = sub i64 63, %shamt
+ %shifted = lshr i64 %val, %negshamt
+ store i64 %shifted, i64* %valptr
+ store i64 %negshamt, i64* %shamtptr
+ ret void
+}
; arithmetic shift right
;------------------------------------------------------------------------------;
@@ -585,6 +761,23 @@ define void @modify32_ashr_by_complemented(i32* %valptr, i32 %shamt) nounwind {
store i32 %shifted, i32* %valptr
ret void
}
+define void @modify32_ashr_by_complemented_multi_use(i32* %valptr, i32 %shamt, i32* %shamtptr) nounwind {
+; CHECK-LABEL: modify32_ashr_by_complemented_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov w8, #31
+; CHECK-NEXT: ldr w9, [x0]
+; CHECK-NEXT: sub w8, w8, w1
+; CHECK-NEXT: asr w9, w9, w8
+; CHECK-NEXT: str w9, [x0]
+; CHECK-NEXT: str w8, [x2]
+; CHECK-NEXT: ret
+ %val = load i32, i32* %valptr
+ %negshamt = sub i32 31, %shamt
+ %shifted = ashr i32 %val, %negshamt
+ store i32 %shifted, i32* %valptr
+ store i32 %negshamt, i32* %shamtptr
+ ret void
+}
define i64 @reg64_ashr_by_complemented(i64 %val, i64 %shamt) nounwind {
; CHECK-LABEL: reg64_ashr_by_complemented:
@@ -638,6 +831,23 @@ define void @modify64_ashr_by_complemented(i64* %valptr, i64 %shamt) nounwind {
store i64 %shifted, i64* %valptr
ret void
}
+define void @modify64_ashr_by_complemented_multi_use(i64* %valptr, i64 %shamt, i64* %shamtptr) nounwind {
+; CHECK-LABEL: modify64_ashr_by_complemented_multi_use:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov w8, #63
+; CHECK-NEXT: ldr x9, [x0]
+; CHECK-NEXT: sub x8, x8, x1
+; CHECK-NEXT: asr x9, x9, x8
+; CHECK-NEXT: str x9, [x0]
+; CHECK-NEXT: str x8, [x2]
+; CHECK-NEXT: ret
+ %val = load i64, i64* %valptr
+ %negshamt = sub i64 63, %shamt
+ %shifted = ashr i64 %val, %negshamt
+ store i64 %shifted, i64* %valptr
+ store i64 %negshamt, i64* %shamtptr
+ ret void
+}
;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||;
; next let's only test simple reg pattern, and only lshr.
More information about the llvm-commits
mailing list