1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-none-elf -verify-machineinstrs %s -o - | FileCheck %s
4 define i32 @from_cmpeq(i32 %xx, i32 %y) {
5 ; CHECK-LABEL: from_cmpeq:
7 ; CHECK-NEXT: and w8, w1, #0x1
8 ; CHECK-NEXT: cmp w0, #9
9 ; CHECK-NEXT: csel w0, w8, wzr, eq
11 %x = icmp eq i32 %xx, 9
12 %masked = and i32 %y, 1
14 %r = select i1 %x, i32 %masked, i32 0
18 define i32 @from_cmpeq_fail_bad_andmask(i32 %xx, i32 %y) {
19 ; CHECK-LABEL: from_cmpeq_fail_bad_andmask:
21 ; CHECK-NEXT: and w8, w1, #0x3
22 ; CHECK-NEXT: cmp w0, #9
23 ; CHECK-NEXT: csel w0, w8, wzr, eq
25 %x = icmp eq i32 %xx, 9
26 %masked = and i32 %y, 3
27 %r = select i1 %x, i32 %masked, i32 0
31 define i32 @from_i1(i1 %x, i32 %y) {
32 ; CHECK-LABEL: from_i1:
34 ; CHECK-NEXT: and w8, w0, w1
35 ; CHECK-NEXT: and w0, w8, #0x1
37 %masked = and i32 %y, 1
38 %r = select i1 %x, i32 %masked, i32 0
42 define i32 @from_trunc_i8(i8 %xx, i32 %y) {
43 ; CHECK-LABEL: from_trunc_i8:
45 ; CHECK-NEXT: and w8, w0, w1
46 ; CHECK-NEXT: and w0, w8, #0x1
48 %masked = and i32 %y, 1
49 %x = trunc i8 %xx to i1
50 %r = select i1 %x, i32 %masked, i32 0
54 define i32 @from_trunc_i64(i64 %xx, i32 %y) {
55 ; CHECK-LABEL: from_trunc_i64:
57 ; CHECK-NEXT: and w8, w0, w1
58 ; CHECK-NEXT: and w0, w8, #0x1
60 %masked = and i32 %y, 1
61 %x = trunc i64 %xx to i1
62 %r = select i1 %x, i32 %masked, i32 0
66 define i32 @from_i1_fail_bad_select0(i1 %x, i32 %y) {
67 ; CHECK-LABEL: from_i1_fail_bad_select0:
69 ; CHECK-NEXT: and w8, w1, #0x1
70 ; CHECK-NEXT: tst w0, #0x1
71 ; CHECK-NEXT: csinc w0, w8, wzr, ne
73 %masked = and i32 %y, 1
74 %r = select i1 %x, i32 %masked, i32 1
78 define i32 @from_i1_fail_bad_select1(i1 %x, i32 %y) {
79 ; CHECK-LABEL: from_i1_fail_bad_select1:
81 ; CHECK-NEXT: and w8, w1, #0x1
82 ; CHECK-NEXT: tst w0, #0x1
83 ; CHECK-NEXT: csel w0, wzr, w8, ne
85 %masked = and i32 %y, 1
86 %r = select i1 %x, i32 0, i32 %masked