[llvm-branch-commits] [llvm] d08cafc - update tests

Karl Meakin via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Sep 23 19:37:14 PDT 2022


Author: Karl Meakin
Date: 2022-09-24T03:35:52+01:00
New Revision: d08cafc126483980c7589ed3a90c9c147d78f763

URL: https://github.com/llvm/llvm-project/commit/d08cafc126483980c7589ed3a90c9c147d78f763
DIFF: https://github.com/llvm/llvm-project/commit/d08cafc126483980c7589ed3a90c9c147d78f763.diff

LOG: update tests

Added: 
    

Modified: 
    llvm/test/CodeGen/AArch64/cmp-chains.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AArch64/cmp-chains.ll b/llvm/test/CodeGen/AArch64/cmp-chains.ll
index e31ddc39c9fe..ed73aa95900b 100644
--- a/llvm/test/CodeGen/AArch64/cmp-chains.ll
+++ b/llvm/test/CodeGen/AArch64/cmp-chains.ll
@@ -2,18 +2,18 @@
 ; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s --check-prefixes=CHECK,SDISEL
 ; RUN: llc < %s -mtriple=aarch64-- -global-isel | FileCheck %s --check-prefixes=CHECK,GISEL
 
-; Ensure chains of comparisons produce chains of `ccmp`
+; Ensure chains of comparisons produce chains of `ccmp`, `ccmn` or `fccmp`.
 
 ; (x0 < x1) && (x2 > x3)
-define i32 @cmp_and2(i32 %0, i32 %1, i32 %2, i32 %3) {
-; SDISEL-LABEL: cmp_and2:
+define i1 @icmp_and2(i32 %0, i32 %1, i32 %2, i32 %3) {
+; SDISEL-LABEL: icmp_and2:
 ; SDISEL:       // %bb.0:
 ; SDISEL-NEXT:    cmp w0, w1
 ; SDISEL-NEXT:    ccmp w2, w3, #0, lo
 ; SDISEL-NEXT:    cset w0, hi
 ; SDISEL-NEXT:    ret
 ;
-; GISEL-LABEL: cmp_and2:
+; GISEL-LABEL: icmp_and2:
 ; GISEL:       // %bb.0:
 ; GISEL-NEXT:    cmp w0, w1
 ; GISEL-NEXT:    cset w8, lo
@@ -23,14 +23,13 @@ define i32 @cmp_and2(i32 %0, i32 %1, i32 %2, i32 %3) {
 ; GISEL-NEXT:    ret
   %5 = icmp ult i32 %0, %1
   %6 = icmp ugt i32 %2, %3
-  %7 = select i1 %5, i1 %6, i1 false
-  %8 = zext i1 %7 to i32
-  ret i32 %8
+  %7 = and i1 %5, %6
+  ret i1 %7
 }
 
 ; (x0 < x1) && (x2 > x3) && (x4 != x5)
-define i32 @cmp_and3(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
-; SDISEL-LABEL: cmp_and3:
+define i1 @icmp_and3(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
+; SDISEL-LABEL: icmp_and3:
 ; SDISEL:       // %bb.0:
 ; SDISEL-NEXT:    cmp w0, w1
 ; SDISEL-NEXT:    ccmp w2, w3, #0, lo
@@ -38,7 +37,7 @@ define i32 @cmp_and3(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
 ; SDISEL-NEXT:    cset w0, ne
 ; SDISEL-NEXT:    ret
 ;
-; GISEL-LABEL: cmp_and3:
+; GISEL-LABEL: icmp_and3:
 ; GISEL:       // %bb.0:
 ; GISEL-NEXT:    cmp w0, w1
 ; GISEL-NEXT:    cset w8, lo
@@ -51,16 +50,15 @@ define i32 @cmp_and3(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
 ; GISEL-NEXT:    ret
   %7 = icmp ult i32 %0, %1
   %8 = icmp ugt i32 %2, %3
-  %9 = select i1 %7, i1 %8, i1 false
+  %9 = and i1 %7, %8
   %10 = icmp ne i32 %4, %5
-  %11 = select i1 %9, i1 %10, i1 false
-  %12 = zext i1 %11 to i32
-  ret i32 %12
+  %11 = and i1 %9, %10
+  ret i1 %11
 }
 
 ; (x0 < x1) && (x2 > x3) && (x4 != x5) && (x6 == x7)
-define i32 @cmp_and4(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
-; SDISEL-LABEL: cmp_and4:
+define i1 @icmp_and4(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
+; SDISEL-LABEL: icmp_and4:
 ; SDISEL:       // %bb.0:
 ; SDISEL-NEXT:    cmp w2, w3
 ; SDISEL-NEXT:    ccmp w0, w1, #2, hi
@@ -69,7 +67,7 @@ define i32 @cmp_and4(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32
 ; SDISEL-NEXT:    cset w0, eq
 ; SDISEL-NEXT:    ret
 ;
-; GISEL-LABEL: cmp_and4:
+; GISEL-LABEL: icmp_and4:
 ; GISEL:       // %bb.0:
 ; GISEL-NEXT:    cmp w2, w3
 ; GISEL-NEXT:    cset w8, hi
@@ -85,25 +83,24 @@ define i32 @cmp_and4(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32
 ; GISEL-NEXT:    ret
   %9 = icmp ugt i32 %2, %3
   %10 = icmp ult i32 %0, %1
-  %11 = select i1 %9, i1 %10, i1 false
+  %11 = and i1 %9, %10
   %12 = icmp ne i32 %4, %5
-  %13 = select i1 %11, i1 %12, i1 false
+  %13 = and i1 %11, %12
   %14 = icmp eq i32 %6, %7
-  %15 = select i1 %13, i1 %14, i1 false
-  %16 = zext i1 %15 to i32
-  ret i32 %16
+  %15 = and i1 %13, %14
+  ret i1 %15
 }
 
 ; (x0 < x1) || (x2 > x3)
-define i32 @cmp_or2(i32 %0, i32 %1, i32 %2, i32 %3) {
-; SDISEL-LABEL: cmp_or2:
+define i1 @icmp_or2(i32 %0, i32 %1, i32 %2, i32 %3) {
+; SDISEL-LABEL: icmp_or2:
 ; SDISEL:       // %bb.0:
 ; SDISEL-NEXT:    cmp w0, w1
 ; SDISEL-NEXT:    ccmp w2, w3, #0, hs
 ; SDISEL-NEXT:    cset w0, ne
 ; SDISEL-NEXT:    ret
 ;
-; GISEL-LABEL: cmp_or2:
+; GISEL-LABEL: icmp_or2:
 ; GISEL:       // %bb.0:
 ; GISEL-NEXT:    cmp w0, w1
 ; GISEL-NEXT:    cset w8, lo
@@ -113,14 +110,13 @@ define i32 @cmp_or2(i32 %0, i32 %1, i32 %2, i32 %3) {
 ; GISEL-NEXT:    ret
   %5 = icmp ult i32 %0, %1
   %6 = icmp ne i32 %2, %3
-  %7 = select i1 %5, i1 true, i1 %6
-  %8 = zext i1 %7 to i32
-  ret i32 %8
+  %7 = or i1 %5, %6
+  ret i1 %7
 }
 
 ; (x0 < x1) || (x2 > x3) || (x4 != x5)
-define i32 @cmp_or3(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
-; SDISEL-LABEL: cmp_or3:
+define i1 @icmp_or3(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
+; SDISEL-LABEL: icmp_or3:
 ; SDISEL:       // %bb.0:
 ; SDISEL-NEXT:    cmp w0, w1
 ; SDISEL-NEXT:    ccmp w2, w3, #2, hs
@@ -128,7 +124,7 @@ define i32 @cmp_or3(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
 ; SDISEL-NEXT:    cset w0, ne
 ; SDISEL-NEXT:    ret
 ;
-; GISEL-LABEL: cmp_or3:
+; GISEL-LABEL: icmp_or3:
 ; GISEL:       // %bb.0:
 ; GISEL-NEXT:    cmp w0, w1
 ; GISEL-NEXT:    cset w8, lo
@@ -141,16 +137,15 @@ define i32 @cmp_or3(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
 ; GISEL-NEXT:    ret
   %7 = icmp ult i32 %0, %1
   %8 = icmp ugt i32 %2, %3
-  %9 = select i1 %7, i1 true, i1 %8
+  %9 = or i1 %7, %8
   %10 = icmp ne i32 %4, %5
-  %11 = select i1 %9, i1 true, i1 %10
-  %12 = zext i1 %11 to i32
- ret i32 %12
+  %11 = or i1 %9, %10
+ ret i1 %11
 }
 
 ; (x0 < x1) || (x2 > x3) || (x4 != x5) || (x6 == x7)
-define i32 @cmp_or4(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
-; SDISEL-LABEL: cmp_or4:
+define i1 @icmp_or4(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
+; SDISEL-LABEL: icmp_or4:
 ; SDISEL:       // %bb.0:
 ; SDISEL-NEXT:    cmp w0, w1
 ; SDISEL-NEXT:    ccmp w2, w3, #2, hs
@@ -159,7 +154,7 @@ define i32 @cmp_or4(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32
 ; SDISEL-NEXT:    cset w0, eq
 ; SDISEL-NEXT:    ret
 ;
-; GISEL-LABEL: cmp_or4:
+; GISEL-LABEL: icmp_or4:
 ; GISEL:       // %bb.0:
 ; GISEL-NEXT:    cmp w0, w1
 ; GISEL-NEXT:    cset w8, lo
@@ -175,17 +170,16 @@ define i32 @cmp_or4(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32
 ; GISEL-NEXT:    ret
   %9 = icmp ult i32 %0, %1
   %10 = icmp ugt i32 %2, %3
-  %11 = select i1 %9, i1 true, i1 %10
+  %11 = or i1 %9, %10
   %12 = icmp ne i32 %4, %5
-  %13 = select i1 %11, i1 true, i1 %12
+  %13 = or i1 %11, %12
   %14 = icmp eq i32 %6, %7
-  %15 = select i1 %13, i1 true, i1 %14
-  %16 = zext i1 %15 to i32
-  ret i32 %16
+  %15 = or i1 %13, %14
+  ret i1 %15
 }
 
 ; (x0 != 0) || (x1 != 0)
-define i32 @true_or2(i32 %0, i32 %1) {
+define i1 @true_or2(i32 %0, i32 %1) {
 ; SDISEL-LABEL: true_or2:
 ; SDISEL:       // %bb.0:
 ; SDISEL-NEXT:    orr w8, w0, w1
@@ -203,13 +197,12 @@ define i32 @true_or2(i32 %0, i32 %1) {
 ; GISEL-NEXT:    ret
   %3 = icmp ne i32 %0, 0
   %4 = icmp ne i32 %1, 0
-  %5 = select i1 %3, i1 true, i1 %4
-  %6 = zext i1 %5 to i32
-  ret i32 %6
+  %5 = or i1 %3, %4
+  ret i1 %5
 }
 
 ; (x0 != 0) || (x1 != 0) || (x2 != 0)
-define i32 @true_or3(i32 %0, i32 %1, i32 %2) {
+define i1 @true_or3(i32 %0, i32 %1, i32 %2) {
 ; SDISEL-LABEL: true_or3:
 ; SDISEL:       // %bb.0:
 ; SDISEL-NEXT:    orr w8, w0, w1
@@ -231,11 +224,237 @@ define i32 @true_or3(i32 %0, i32 %1, i32 %2) {
 ; GISEL-NEXT:    ret
   %4 = icmp ne i32 %0, 0
   %5 = icmp ne i32 %1, 0
-  %6 = select i1 %4, i1 true, i1 %5
+  %6 = or i1 %4, %5
   %7 = icmp ne i32 %2, 0
-  %8 = select i1 %6, i1 true, i1 %7
-  %9 = zext i1 %8 to i32
-  ret i32 %9
+  %8 = or i1 %6, %7
+  ret i1 %8
+}
+
+; (x0 < x1) && (x2 > x3)
+define i1 @fcmp_and2(float %0, float %1, float %2, float %3) {
+; SDISEL-LABEL: fcmp_and2:
+; SDISEL:       // %bb.0:
+; SDISEL-NEXT:    fcmp s0, s1
+; SDISEL-NEXT:    fccmp s2, s3, #0, lt
+; SDISEL-NEXT:    cset w0, hi
+; SDISEL-NEXT:    ret
+;
+; GISEL-LABEL: fcmp_and2:
+; GISEL:       // %bb.0:
+; GISEL-NEXT:    fcmp s0, s1
+; GISEL-NEXT:    cset w8, lt
+; GISEL-NEXT:    fcmp s2, s3
+; GISEL-NEXT:    cset w9, hi
+; GISEL-NEXT:    and w0, w8, w9
+; GISEL-NEXT:    ret
+  %5 = fcmp ult float %0, %1
+  %6 = fcmp ugt float %2, %3
+  %7 = and i1 %5, %6
+  ret i1 %7
+}
+
+; (x0 < x1) && (x2 > x3) && (x4 != x5)
+define i1 @fcmp_and3(float %0, float %1, float %2, float %3, float %4, float %5) {
+; SDISEL-LABEL: fcmp_and3:
+; SDISEL:       // %bb.0:
+; SDISEL-NEXT:    fcmp s0, s1
+; SDISEL-NEXT:    fccmp s2, s3, #0, lt
+; SDISEL-NEXT:    fccmp s4, s5, #4, hi
+; SDISEL-NEXT:    cset w0, ne
+; SDISEL-NEXT:    ret
+;
+; GISEL-LABEL: fcmp_and3:
+; GISEL:       // %bb.0:
+; GISEL-NEXT:    fcmp s0, s1
+; GISEL-NEXT:    cset w8, lt
+; GISEL-NEXT:    fcmp s2, s3
+; GISEL-NEXT:    cset w9, hi
+; GISEL-NEXT:    fcmp s4, s5
+; GISEL-NEXT:    and w8, w8, w9
+; GISEL-NEXT:    cset w9, ne
+; GISEL-NEXT:    and w0, w8, w9
+; GISEL-NEXT:    ret
+  %7 = fcmp ult float %0, %1
+  %8 = fcmp ugt float %2, %3
+  %9 = and i1 %7, %8
+  %10 = fcmp une float %4, %5
+  %11 = and i1 %9, %10
+  ret i1 %11
+}
+
+; (x0 < x1) && (x2 > x3) && (x4 != x5) && (x6 == x7)
+define i1 @fcmp_and4(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7) {
+; SDISEL-LABEL: fcmp_and4:
+; SDISEL:       // %bb.0:
+; SDISEL-NEXT:    fcmp s2, s3
+; SDISEL-NEXT:    fccmp s0, s1, #0, hi
+; SDISEL-NEXT:    fccmp s4, s5, #4, lt
+; SDISEL-NEXT:    fccmp s6, s7, #0, ne
+; SDISEL-NEXT:    cset w0, eq
+; SDISEL-NEXT:    ret
+;
+; GISEL-LABEL: fcmp_and4:
+; GISEL:       // %bb.0:
+; GISEL-NEXT:    fcmp s2, s3
+; GISEL-NEXT:    cset w8, hi
+; GISEL-NEXT:    fcmp s0, s1
+; GISEL-NEXT:    cset w9, lt
+; GISEL-NEXT:    fcmp s4, s5
+; GISEL-NEXT:    and w8, w8, w9
+; GISEL-NEXT:    cset w9, ne
+; GISEL-NEXT:    fcmp s6, s7
+; GISEL-NEXT:    and w8, w8, w9
+; GISEL-NEXT:    cset w9, eq
+; GISEL-NEXT:    and w0, w8, w9
+; GISEL-NEXT:    ret
+  %9 = fcmp ugt float %2, %3
+  %10 = fcmp ult float %0, %1
+  %11 = and i1 %9, %10
+  %12 = fcmp une float %4, %5
+  %13 = and i1 %11, %12
+  %14 = fcmp oeq float %6, %7
+  %15 = and i1 %13, %14
+  ret i1 %15
+}
+
+; (x0 < x1) || (x2 > x3)
+define i1 @fcmp_or2(float %0, float %1, float %2, float %3) {
+; SDISEL-LABEL: fcmp_or2:
+; SDISEL:       // %bb.0:
+; SDISEL-NEXT:    fcmp s0, s1
+; SDISEL-NEXT:    fccmp s2, s3, #2, ge
+; SDISEL-NEXT:    cset w0, hi
+; SDISEL-NEXT:    ret
+;
+; GISEL-LABEL: fcmp_or2:
+; GISEL:       // %bb.0:
+; GISEL-NEXT:    fcmp s0, s1
+; GISEL-NEXT:    cset w8, lt
+; GISEL-NEXT:    fcmp s2, s3
+; GISEL-NEXT:    cset w9, hi
+; GISEL-NEXT:    orr w0, w8, w9
+; GISEL-NEXT:    ret
+  %5 = fcmp ult float %0, %1
+  %6 = fcmp ugt float %2, %3
+  %7 = or i1 %5, %6
+  ret i1 %7
+}
+
+; (x0 < x1) || (x2 > x3) || (x4 != x5)
+define i1 @fcmp_or3(float %0, float %1, float %2, float %3, float %4, float %5) {
+; SDISEL-LABEL: fcmp_or3:
+; SDISEL:       // %bb.0:
+; SDISEL-NEXT:    fcmp s0, s1
+; SDISEL-NEXT:    fccmp s2, s3, #2, ge
+; SDISEL-NEXT:    fccmp s4, s5, #0, ls
+; SDISEL-NEXT:    cset w0, ne
+; SDISEL-NEXT:    ret
+;
+; GISEL-LABEL: fcmp_or3:
+; GISEL:       // %bb.0:
+; GISEL-NEXT:    fcmp s0, s1
+; GISEL-NEXT:    cset w8, lt
+; GISEL-NEXT:    fcmp s2, s3
+; GISEL-NEXT:    cset w9, hi
+; GISEL-NEXT:    fcmp s4, s5
+; GISEL-NEXT:    orr w8, w8, w9
+; GISEL-NEXT:    cset w9, ne
+; GISEL-NEXT:    orr w0, w8, w9
+; GISEL-NEXT:    ret
+  %7 = fcmp ult float %0, %1
+  %8 = fcmp ugt float %2, %3
+  %9 = or i1 %7, %8
+  %10 = fcmp une float %4, %5
+  %11 = or i1 %9, %10
+  ret i1 %11
+}
+
+; (x0 < x1) || (x2 > x3) || (x4 != x5) || (x6 == x7)
+define i1 @fcmp_or4(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7) {
+; SDISEL-LABEL: fcmp_or4:
+; SDISEL:       // %bb.0:
+; SDISEL-NEXT:    fcmp s2, s3
+; SDISEL-NEXT:    fccmp s0, s1, #8, ls
+; SDISEL-NEXT:    fccmp s4, s5, #0, ge
+; SDISEL-NEXT:    fccmp s6, s7, #4, eq
+; SDISEL-NEXT:    cset w0, eq
+; SDISEL-NEXT:    ret
+;
+; GISEL-LABEL: fcmp_or4:
+; GISEL:       // %bb.0:
+; GISEL-NEXT:    fcmp s2, s3
+; GISEL-NEXT:    cset w8, hi
+; GISEL-NEXT:    fcmp s0, s1
+; GISEL-NEXT:    cset w9, lt
+; GISEL-NEXT:    fcmp s4, s5
+; GISEL-NEXT:    orr w8, w8, w9
+; GISEL-NEXT:    cset w9, ne
+; GISEL-NEXT:    fcmp s6, s7
+; GISEL-NEXT:    orr w8, w8, w9
+; GISEL-NEXT:    cset w9, eq
+; GISEL-NEXT:    orr w0, w8, w9
+; GISEL-NEXT:    ret
+  %9 = fcmp ugt float %2, %3
+  %10 = fcmp ult float %0, %1
+  %11 = or i1 %9, %10
+  %12 = fcmp une float %4, %5
+  %13 = or i1 %11, %12
+  %14 = fcmp oeq float %6, %7
+  %15 = or i1 %13, %14
+  ret i1 %15
+}
+
+; (x0 == 0.0) && (x1 == 0.0)
+define i1 @fcmp_zero2(float %0, float %1) {
+; SDISEL-LABEL: fcmp_zero2:
+; SDISEL:       // %bb.0:
+; SDISEL-NEXT:    fcmp s0, #0.0
+; SDISEL-NEXT:    fccmp s1, s0, #0, eq
+; SDISEL-NEXT:    cset w0, eq
+; SDISEL-NEXT:    ret
+;
+; GISEL-LABEL: fcmp_zero2:
+; GISEL:       // %bb.0:
+; GISEL-NEXT:    fcmp s0, #0.0
+; GISEL-NEXT:    cset w8, eq
+; GISEL-NEXT:    fcmp s1, #0.0
+; GISEL-NEXT:    cset w9, eq
+; GISEL-NEXT:    and w0, w8, w9
+; GISEL-NEXT:    ret
+  %3 = fcmp oeq float %0, 0.0
+  %4 = fcmp oeq float %1, 0.0
+  %5 = and i1 %3, %4
+  ret i1 %5
+}
+
+; (x0 == 0.0) && (x1 == 0.0) && (x2 == 0.0)
+define i1 @fcmp_zero3(float %0, float %1, float %2) {
+; SDISEL-LABEL: fcmp_zero3:
+; SDISEL:       // %bb.0:
+; SDISEL-NEXT:    fcmp s0, #0.0
+; SDISEL-NEXT:    movi d3, #0000000000000000
+; SDISEL-NEXT:    fccmp s1, s0, #0, eq
+; SDISEL-NEXT:    fccmp s2, s3, #0, eq
+; SDISEL-NEXT:    cset w0, eq
+; SDISEL-NEXT:    ret
+;
+; GISEL-LABEL: fcmp_zero3:
+; GISEL:       // %bb.0:
+; GISEL-NEXT:    fcmp s0, #0.0
+; GISEL-NEXT:    cset w8, eq
+; GISEL-NEXT:    fcmp s1, #0.0
+; GISEL-NEXT:    cset w9, eq
+; GISEL-NEXT:    fcmp s2, #0.0
+; GISEL-NEXT:    and w8, w8, w9
+; GISEL-NEXT:    cset w9, eq
+; GISEL-NEXT:    and w0, w8, w9
+; GISEL-NEXT:    ret
+  %4 = fcmp oeq float %0, 0.0
+  %5 = fcmp oeq float %1, 0.0
+  %6 = and i1 %4, %5
+  %7 = fcmp oeq float %2, 0.0
+  %8 = and i1 %6, %7
+  ret i1 %8
 }
 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
 ; CHECK: {{.*}}


        


More information about the llvm-branch-commits mailing list