[llvm] a5ce2da - [NFC]Pre-commit test case
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 27 10:56:01 PDT 2023
Author: Mingming Liu
Date: 2023-03-27T10:55:41-07:00
New Revision: a5ce2da0545bd19d158e1c7e80474d9ddaf5df66
URL: https://github.com/llvm/llvm-project/commit/a5ce2da0545bd19d158e1c7e80474d9ddaf5df66
DIFF: https://github.com/llvm/llvm-project/commit/a5ce2da0545bd19d158e1c7e80474d9ddaf5df66.diff
LOG: [NFC]Pre-commit test case
Pre-commit test cases to show missed icmp-opt with flag-setting ALUs
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D146754
Added:
llvm/test/CodeGen/AArch64/aarch64-icmp-opt.ll
Modified:
llvm/test/CodeGen/AArch64/arm64-csel.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/AArch64/aarch64-icmp-opt.ll b/llvm/test/CodeGen/AArch64/aarch64-icmp-opt.ll
new file mode 100644
index 0000000000000..bceec8d77db80
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/aarch64-icmp-opt.ll
@@ -0,0 +1,122 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
+; RUN: llc -O3 -mtriple=aarch64 %s -o - | FileCheck %s
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64-unknown-linux-gnu"
+
+define i32 @sub_icmp_i32(i32 %0, i32 %1) {
+; CHECK-LABEL: sub_icmp_i32:
+; CHECK: // %bb.0:
+; CHECK-NEXT: sub w0, w0, w1
+; CHECK-NEXT: cmp w0, #0
+; CHECK-NEXT: b.le .LBB0_2
+; CHECK-NEXT: // %bb.1:
+; CHECK-NEXT: b _Z2f2i
+; CHECK-NEXT: .LBB0_2:
+; CHECK-NEXT: b _Z2f1i
+ %3 = sub nsw i32 %0, %1
+ %4 = icmp slt i32 %3, 1
+ br i1 %4, label %5, label %7
+
+5:
+ %6 = tail call i32 @_Z2f1i(i32 %3)
+ br label %9
+
+7:
+ %8 = tail call i32 @_Z2f2i(i32 %3)
+ br label %9
+
+9:
+ %10 = phi i32 [ %6, %5 ], [ %8, %7 ]
+ ret i32 %10
+}
+
+
+
+define i64 @sub_icmp_i64(i64 %0, i64 %1) {
+; CHECK-LABEL: sub_icmp_i64:
+; CHECK: // %bb.0:
+; CHECK-NEXT: sub x0, x0, x1
+; CHECK-NEXT: cmp x0, #0
+; CHECK-NEXT: b.le .LBB1_2
+; CHECK-NEXT: // %bb.1:
+; CHECK-NEXT: b _Z2f4l
+; CHECK-NEXT: .LBB1_2:
+; CHECK-NEXT: b _Z2f3l
+ %3 = sub nsw i64 %0, %1
+ %4 = icmp slt i64 %3, 1
+ br i1 %4, label %5, label %7
+
+5:
+ %6 = tail call i64 @_Z2f3l(i64 %3)
+ br label %9
+
+7:
+ %8 = tail call i64 @_Z2f4l(i64 %3)
+ br label %9
+
+9:
+ %10 = phi i64 [ %6, %5 ], [ %8, %7 ]
+ ret i64 %10
+}
+
+define i64 @add_i64(i64 %0, i64 %1) {
+; CHECK-LABEL: add_i64:
+; CHECK: // %bb.0:
+; CHECK-NEXT: add x0, x1, x0
+; CHECK-NEXT: cmp x0, #0
+; CHECK-NEXT: b.le .LBB2_2
+; CHECK-NEXT: // %bb.1:
+; CHECK-NEXT: b _Z2f4l
+; CHECK-NEXT: .LBB2_2:
+; CHECK-NEXT: b _Z2f3l
+ %3 = add nsw i64 %1, %0
+ %4 = icmp slt i64 %3, 1
+ br i1 %4, label %5, label %7
+
+5:
+ %6 = tail call i64 @_Z2f3l(i64 %3)
+ br label %9
+
+7:
+ %8 = tail call i64 @_Z2f4l(i64 %3)
+ br label %9
+
+9:
+ %10 = phi i64 [ %6, %5 ], [ %8, %7 ]
+ ret i64 %10
+}
+
+define i32 @add_i32(i32 %0, i32 %1) {
+; CHECK-LABEL: add_i32:
+; CHECK: // %bb.0:
+; CHECK-NEXT: add w0, w1, w0
+; CHECK-NEXT: cmp w0, #0
+; CHECK-NEXT: b.le .LBB3_2
+; CHECK-NEXT: // %bb.1:
+; CHECK-NEXT: b _Z2f4l
+; CHECK-NEXT: .LBB3_2:
+; CHECK-NEXT: b _Z2f3l
+ %3 = add nsw i32 %1, %0
+ %4 = icmp slt i32 %3, 1
+ br i1 %4, label %5, label %7
+
+5:
+ %6 = tail call i32 @_Z2f3l(i32 %3)
+ br label %9
+
+7:
+ %8 = tail call i32 @_Z2f4l(i32 %3)
+ br label %9
+
+9:
+ %10 = phi i32 [ %6, %5 ], [ %8, %7 ]
+ ret i32 %10
+}
+
+
+
+declare i32 @_Z2f1i(i32)
+declare i32 @_Z2f2i(i32)
+declare i64 @_Z2f3l(i64)
+declare i64 @_Z2f4l(i64)
diff --git a/llvm/test/CodeGen/AArch64/arm64-csel.ll b/llvm/test/CodeGen/AArch64/arm64-csel.ll
index 5dd826d9bf549..246d96f488de3 100644
--- a/llvm/test/CodeGen/AArch64/arm64-csel.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-csel.ll
@@ -137,7 +137,7 @@ entry:
define i32 @foo9(i32 %v) nounwind readnone optsize ssp {
; CHECK-LABEL: foo9:
; CHECK: // %bb.0: // %entry
-; CHECK-NEXT: mov w8, #4
+; CHECK-NEXT: mov w8, #4 // =0x4
; CHECK-NEXT: cmp w0, #0
; CHECK-NEXT: cinv w0, w8, eq
; CHECK-NEXT: ret
@@ -150,7 +150,7 @@ entry:
define i64 @foo10(i64 %v) nounwind readnone optsize ssp {
; CHECK-LABEL: foo10:
; CHECK: // %bb.0: // %entry
-; CHECK-NEXT: mov w8, #4
+; CHECK-NEXT: mov w8, #4 // =0x4
; CHECK-NEXT: cmp x0, #0
; CHECK-NEXT: cinv x0, x8, eq
; CHECK-NEXT: ret
@@ -163,7 +163,7 @@ entry:
define i32 @foo11(i32 %v) nounwind readnone optsize ssp {
; CHECK-LABEL: foo11:
; CHECK: // %bb.0: // %entry
-; CHECK-NEXT: mov w8, #4
+; CHECK-NEXT: mov w8, #4 // =0x4
; CHECK-NEXT: cmp w0, #0
; CHECK-NEXT: cneg w0, w8, eq
; CHECK-NEXT: ret
@@ -176,7 +176,7 @@ entry:
define i64 @foo12(i64 %v) nounwind readnone optsize ssp {
; CHECK-LABEL: foo12:
; CHECK: // %bb.0: // %entry
-; CHECK-NEXT: mov w8, #4
+; CHECK-NEXT: mov w8, #4 // =0x4
; CHECK-NEXT: cmp x0, #0
; CHECK-NEXT: cneg x0, x8, eq
; CHECK-NEXT: ret
@@ -216,7 +216,7 @@ define i32 @foo15(i32 %a, i32 %b) nounwind readnone optsize ssp {
; CHECK-LABEL: foo15:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: cmp w0, w1
-; CHECK-NEXT: mov w8, #1
+; CHECK-NEXT: mov w8, #1 // =0x1
; CHECK-NEXT: cinc w0, w8, gt
; CHECK-NEXT: ret
entry:
@@ -229,7 +229,7 @@ define i32 @foo16(i32 %a, i32 %b) nounwind readnone optsize ssp {
; CHECK-LABEL: foo16:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: cmp w0, w1
-; CHECK-NEXT: mov w8, #1
+; CHECK-NEXT: mov w8, #1 // =0x1
; CHECK-NEXT: cinc w0, w8, le
; CHECK-NEXT: ret
entry:
@@ -242,7 +242,7 @@ define i64 @foo17(i64 %a, i64 %b) nounwind readnone optsize ssp {
; CHECK-LABEL: foo17:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: cmp x0, x1
-; CHECK-NEXT: mov w8, #1
+; CHECK-NEXT: mov w8, #1 // =0x1
; CHECK-NEXT: cinc x0, x8, gt
; CHECK-NEXT: ret
entry:
@@ -255,7 +255,7 @@ define i64 @foo18(i64 %a, i64 %b) nounwind readnone optsize ssp {
; CHECK-LABEL: foo18:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: cmp x0, x1
-; CHECK-NEXT: mov w8, #1
+; CHECK-NEXT: mov w8, #1 // =0x1
; CHECK-NEXT: cinc x0, x8, le
; CHECK-NEXT: ret
entry:
@@ -269,7 +269,7 @@ define i64 @foo18_overflow1(i64 %a, i64 %b) nounwind readnone optsize ssp {
; CHECK-LABEL: foo18_overflow1:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: cmp x0, x1
-; CHECK-NEXT: mov x8, #9223372036854775807
+; CHECK-NEXT: mov x8, #9223372036854775807 // =0x7fffffffffffffff
; CHECK-NEXT: csel x0, x8, xzr, gt
; CHECK-NEXT: ret
entry:
@@ -283,7 +283,7 @@ define i64 @foo18_overflow2(i64 %a, i64 %b) nounwind readnone optsize ssp {
; CHECK-LABEL: foo18_overflow2:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: cmp x0, x1
-; CHECK-NEXT: mov x8, #9223372036854775807
+; CHECK-NEXT: mov x8, #9223372036854775807 // =0x7fffffffffffffff
; CHECK-NEXT: csel x0, xzr, x8, gt
; CHECK-NEXT: ret
entry:
@@ -296,9 +296,9 @@ entry:
define i64 @foo18_overflow3(i1 %cmp) nounwind readnone optsize ssp {
; CHECK-LABEL: foo18_overflow3:
; CHECK: // %bb.0: // %entry
-; CHECK-NEXT: mov x8, #-9223372036854775808
-; CHECK-NEXT: tst w0, #0x1
-; CHECK-NEXT: csel x0, x8, xzr, ne
+; CHECK-NEXT: mov x8, #-9223372036854775808 // =0x8000000000000000
+; CHECK-NEXT: tst w0, #0x1
+; CHECK-NEXT: csel x0, x8, xzr, ne
; CHECK-NEXT: ret
entry:
%. = select i1 %cmp, i64 -9223372036854775808, i64 0
@@ -309,9 +309,9 @@ entry:
define i64 @foo18_overflow4(i1 %cmp) nounwind readnone optsize ssp {
; CHECK-LABEL: foo18_overflow4:
; CHECK: // %bb.0: // %entry
-; CHECK-NEXT: mov x8, #-9223372036854775808
-; CHECK-NEXT: tst w0, #0x1
-; CHECK-NEXT: csel x0, xzr, x8, ne
+; CHECK-NEXT: mov x8, #-9223372036854775808 // =0x8000000000000000
+; CHECK-NEXT: tst w0, #0x1
+; CHECK-NEXT: csel x0, xzr, x8, ne
; CHECK-NEXT: ret
entry:
%. = select i1 %cmp, i64 0, i64 -9223372036854775808
@@ -334,7 +334,7 @@ entry:
define i32 @foo20(i32 %x) {
; CHECK-LABEL: foo20:
; CHECK: // %bb.0:
-; CHECK-NEXT: mov w8, #6
+; CHECK-NEXT: mov w8, #6 // =0x6
; CHECK-NEXT: cmp w0, #5
; CHECK-NEXT: csinc w0, w8, wzr, eq
; CHECK-NEXT: ret
@@ -346,7 +346,7 @@ define i32 @foo20(i32 %x) {
define i64 @foo21(i64 %x) {
; CHECK-LABEL: foo21:
; CHECK: // %bb.0:
-; CHECK-NEXT: mov w8, #6
+; CHECK-NEXT: mov w8, #6 // =0x6
; CHECK-NEXT: cmp x0, #5
; CHECK-NEXT: csinc x0, x8, xzr, eq
; CHECK-NEXT: ret
@@ -358,7 +358,7 @@ define i64 @foo21(i64 %x) {
define i32 @foo22(i32 %x) {
; CHECK-LABEL: foo22:
; CHECK: // %bb.0:
-; CHECK-NEXT: mov w8, #6
+; CHECK-NEXT: mov w8, #6 // =0x6
; CHECK-NEXT: cmp w0, #5
; CHECK-NEXT: csinc w0, w8, wzr, ne
; CHECK-NEXT: ret
@@ -370,7 +370,7 @@ define i32 @foo22(i32 %x) {
define i64 @foo23(i64 %x) {
; CHECK-LABEL: foo23:
; CHECK: // %bb.0:
-; CHECK-NEXT: mov w8, #6
+; CHECK-NEXT: mov w8, #6 // =0x6
; CHECK-NEXT: cmp x0, #5
; CHECK-NEXT: csinc x0, x8, xzr, ne
; CHECK-NEXT: ret
More information about the llvm-commits
mailing list