1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s
3 ; RUN: llc < %s -mtriple=aarch64-- -global-isel -global-isel-abort=1 | FileCheck %s --check-prefix=GISEL
5 define <4 x i32> @sextbool_add_vector(<4 x i32> %c1, <4 x i32> %c2, <4 x i32> %x) {
6 ; CHECK-LABEL: sextbool_add_vector:
8 ; CHECK-NEXT: cmeq v0.4s, v0.4s, v1.4s
9 ; CHECK-NEXT: add v0.4s, v2.4s, v0.4s
12 ; GISEL-LABEL: sextbool_add_vector:
14 ; GISEL-NEXT: cmeq v0.4s, v0.4s, v1.4s
15 ; GISEL-NEXT: add v0.4s, v2.4s, v0.4s
17 %c = icmp eq <4 x i32> %c1, %c2
18 %b = sext <4 x i1> %c to <4 x i32>
19 %s = add <4 x i32> %x, %b
23 define <4 x i32> @zextbool_sub_vector(<4 x i32> %c1, <4 x i32> %c2, <4 x i32> %x) {
24 ; CHECK-LABEL: zextbool_sub_vector:
26 ; CHECK-NEXT: cmeq v0.4s, v0.4s, v1.4s
27 ; CHECK-NEXT: add v0.4s, v2.4s, v0.4s
30 ; GISEL-LABEL: zextbool_sub_vector:
32 ; GISEL-NEXT: movi v3.4s, #1
33 ; GISEL-NEXT: cmeq v0.4s, v0.4s, v1.4s
34 ; GISEL-NEXT: and v0.16b, v0.16b, v3.16b
35 ; GISEL-NEXT: sub v0.4s, v2.4s, v0.4s
37 %c = icmp eq <4 x i32> %c1, %c2
38 %b = zext <4 x i1> %c to <4 x i32>
39 %s = sub <4 x i32> %x, %b
43 define i32 @assertsext_sub_1(i1 signext %cond, i32 %y) {
44 ; CHECK-LABEL: assertsext_sub_1:
46 ; CHECK-NEXT: add w0, w1, w0
49 ; GISEL-LABEL: assertsext_sub_1:
51 ; GISEL-NEXT: and w8, w0, #0x1
52 ; GISEL-NEXT: sub w0, w1, w8
54 %e = zext i1 %cond to i32
59 define i32 @assertsext_add_1(i1 signext %cond, i32 %y) {
60 ; CHECK-LABEL: assertsext_add_1:
62 ; CHECK-NEXT: sub w0, w1, w0
65 ; GISEL-LABEL: assertsext_add_1:
67 ; GISEL-NEXT: and w8, w0, #0x1
68 ; GISEL-NEXT: add w0, w8, w1
70 %e = zext i1 %cond to i32
75 define i32 @assertsext_add_1_commute(i1 signext %cond, i32 %y) {
76 ; CHECK-LABEL: assertsext_add_1_commute:
78 ; CHECK-NEXT: sub w0, w1, w0
81 ; GISEL-LABEL: assertsext_add_1_commute:
83 ; GISEL-NEXT: and w8, w0, #0x1
84 ; GISEL-NEXT: add w0, w1, w8
86 %e = zext i1 %cond to i32
91 define i32 @callee_signext_i1(i1 signext %0) {
92 ; CHECK-LABEL: callee_signext_i1:
96 ; GISEL-LABEL: callee_signext_i1:
99 %r = sext i1 %0 to i32
103 define i32 @caller_signext_i1() {
104 ; CHECK-LABEL: caller_signext_i1:
106 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
107 ; CHECK-NEXT: .cfi_def_cfa_offset 16
108 ; CHECK-NEXT: .cfi_offset w30, -16
109 ; CHECK-NEXT: mov w0, #-1 // =0xffffffff
110 ; CHECK-NEXT: bl callee_signext_i1
111 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
114 ; GISEL-LABEL: caller_signext_i1:
116 ; GISEL-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
117 ; GISEL-NEXT: .cfi_def_cfa_offset 16
118 ; GISEL-NEXT: .cfi_offset w30, -16
119 ; GISEL-NEXT: mov w0, #-1 // =0xffffffff
120 ; GISEL-NEXT: bl callee_signext_i1
121 ; GISEL-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
123 %r = call i32 @callee_signext_i1(i1 signext true)