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: adrp x8, .LCPI1_0
33 ; GISEL-NEXT: cmeq v0.4s, v0.4s, v1.4s
34 ; GISEL-NEXT: ldr q1, [x8, :lo12:.LCPI1_0]
35 ; GISEL-NEXT: and v0.16b, v0.16b, v1.16b
36 ; GISEL-NEXT: sub v0.4s, v2.4s, v0.4s
38 %c = icmp eq <4 x i32> %c1, %c2
39 %b = zext <4 x i1> %c to <4 x i32>
40 %s = sub <4 x i32> %x, %b
44 define i32 @assertsext_sub_1(i1 signext %cond, i32 %y) {
45 ; CHECK-LABEL: assertsext_sub_1:
47 ; CHECK-NEXT: add w0, w1, w0
50 ; GISEL-LABEL: assertsext_sub_1:
52 ; GISEL-NEXT: and w8, w0, #0x1
53 ; GISEL-NEXT: sub w0, w1, w8
55 %e = zext i1 %cond to i32
60 define i32 @assertsext_add_1(i1 signext %cond, i32 %y) {
61 ; CHECK-LABEL: assertsext_add_1:
63 ; CHECK-NEXT: sub w0, w1, w0
66 ; GISEL-LABEL: assertsext_add_1:
68 ; GISEL-NEXT: and w8, w0, #0x1
69 ; GISEL-NEXT: add w0, w8, w1
71 %e = zext i1 %cond to i32
76 define i32 @assertsext_add_1_commute(i1 signext %cond, i32 %y) {
77 ; CHECK-LABEL: assertsext_add_1_commute:
79 ; CHECK-NEXT: sub w0, w1, w0
82 ; GISEL-LABEL: assertsext_add_1_commute:
84 ; GISEL-NEXT: and w8, w0, #0x1
85 ; GISEL-NEXT: add w0, w1, w8
87 %e = zext i1 %cond to i32
92 define i32 @callee_signext_i1(i1 signext %0) {
93 ; CHECK-LABEL: callee_signext_i1:
97 ; GISEL-LABEL: callee_signext_i1:
100 %r = sext i1 %0 to i32
104 define i32 @caller_signext_i1() {
105 ; CHECK-LABEL: caller_signext_i1:
107 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
108 ; CHECK-NEXT: .cfi_def_cfa_offset 16
109 ; CHECK-NEXT: .cfi_offset w30, -16
110 ; CHECK-NEXT: mov w0, #-1 // =0xffffffff
111 ; CHECK-NEXT: bl callee_signext_i1
112 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
115 ; GISEL-LABEL: caller_signext_i1:
117 ; GISEL-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
118 ; GISEL-NEXT: .cfi_def_cfa_offset 16
119 ; GISEL-NEXT: .cfi_offset w30, -16
120 ; GISEL-NEXT: mov w0, #-1 // =0xffffffff
121 ; GISEL-NEXT: bl callee_signext_i1
122 ; GISEL-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
124 %r = call i32 @callee_signext_i1(i1 signext true)