1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc %s -o - -verify-machineinstrs -mtriple=arm64-none-linux-gnu | FileCheck %s
4 ; This is the analogue of AArch64's file of the same name. It's mostly testing
5 ; some form of correct lowering occurs, the tests are a little artificial but I
6 ; strongly suspect there's room for improved CodeGen (FIXME).
8 define i64 @test_sext_extr_cmp_0(<1 x i64> %v1, <1 x i64> %v2) {
9 ; CHECK-LABEL: test_sext_extr_cmp_0:
11 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1
12 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
13 ; CHECK-NEXT: fmov x8, d1
14 ; CHECK-NEXT: fmov x9, d0
15 ; CHECK-NEXT: cmp x9, x8
16 ; CHECK-NEXT: cset w8, ge
17 ; CHECK-NEXT: sbfx x0, x8, #0, #1
19 %1 = icmp sge <1 x i64> %v1, %v2
20 %2 = extractelement <1 x i1> %1, i32 0
21 %vget_lane = sext i1 %2 to i64
25 define i64 @test_sext_extr_cmp_1(<1 x double> %v1, <1 x double> %v2) {
26 ; CHECK-LABEL: test_sext_extr_cmp_1:
28 ; CHECK-NEXT: fcmp d0, d1
29 ; CHECK-NEXT: cset w8, eq
30 ; CHECK-NEXT: sbfx x0, x8, #0, #1
32 %1 = fcmp oeq <1 x double> %v1, %v2
33 %2 = extractelement <1 x i1> %1, i32 0
34 %vget_lane = sext i1 %2 to i64
38 define <1 x i64> @test_select_v1i1_0(<1 x i64> %v1, <1 x i64> %v2, <1 x i64> %v3) {
39 ; CHECK-LABEL: test_select_v1i1_0:
41 ; CHECK-NEXT: cmeq d0, d0, d1
42 ; CHECK-NEXT: bic v0.8b, v2.8b, v0.8b
44 %1 = icmp eq <1 x i64> %v1, %v2
45 %res = select <1 x i1> %1, <1 x i64> zeroinitializer, <1 x i64> %v3
49 define <1 x i64> @test_select_v1i1_1(<1 x double> %v1, <1 x double> %v2, <1 x i64> %v3) {
50 ; CHECK-LABEL: test_select_v1i1_1:
52 ; CHECK-NEXT: fcmeq d0, d0, d1
53 ; CHECK-NEXT: bic v0.8b, v2.8b, v0.8b
55 %1 = fcmp oeq <1 x double> %v1, %v2
56 %res = select <1 x i1> %1, <1 x i64> zeroinitializer, <1 x i64> %v3
60 define <1 x double> @test_select_v1i1_2(<1 x i64> %v1, <1 x i64> %v2, <1 x double> %v3) {
61 ; CHECK-LABEL: test_select_v1i1_2:
63 ; CHECK-NEXT: cmeq d0, d0, d1
64 ; CHECK-NEXT: bic v0.8b, v2.8b, v0.8b
66 %1 = icmp eq <1 x i64> %v1, %v2
67 %res = select <1 x i1> %1, <1 x double> zeroinitializer, <1 x double> %v3
71 ; For v1i64, it's not clear which of the vector or scalar compare is better.
72 ; Let's stick to the vector form, like for all other vector selects fed by a
73 ; scalar setcc. If anything, it exposes more ILP.
74 define <1 x i64> @test_select_v1i1_3(i64 %lhs, i64 %rhs, <1 x i64> %v3) {
75 ; CHECK-LABEL: test_select_v1i1_3:
77 ; CHECK-NEXT: fmov d1, x1
78 ; CHECK-NEXT: fmov d2, x0
79 ; CHECK-NEXT: cmeq d1, d2, d1
80 ; CHECK-NEXT: bic v0.8b, v0.8b, v1.8b
82 %tst = icmp eq i64 %lhs, %rhs
83 %evil = insertelement <1 x i1> undef, i1 %tst, i32 0
84 %res = select <1 x i1> %evil, <1 x i64> zeroinitializer, <1 x i64> %v3
88 define i32 @test_br_extr_cmp(<1 x i64> %v1, <1 x i64> %v2) {
89 ; CHECK-LABEL: test_br_extr_cmp:
90 ; CHECK: // %bb.0: // %common.ret
91 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1
92 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
93 ; CHECK-NEXT: fmov x8, d1
94 ; CHECK-NEXT: fmov x9, d0
95 ; CHECK-NEXT: cmp x9, x8
96 ; CHECK-NEXT: cset w0, eq
98 %1 = icmp eq <1 x i64> %v1, %v2
99 %2 = extractelement <1 x i1> %1, i32 0
100 br i1 %2, label %if.end, label %if.then