AArch64/ARM64: port some NEON tests to ARM64
[oota-llvm.git] / test / CodeGen / AArch64 / neon-v1i1-setcc.ll
1 ; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon -fp-contract=fast | FileCheck %s
2
3 ; This file test the DAG node like "v1i1 SETCC v1i64, v1i64". As the v1i1 type
4 ; is illegal in AArch64 backend, the legalizer tries to scalarize this node.
5 ; As the v1i64 operands of SETCC are legal types, they will not be scalarized.
6 ; Currently the type legalizer will have an assertion failure as it assumes all
7 ; operands of SETCC have been legalized.
8 ; FIXME: If the algorithm of type scalarization is improved and can legaize
9 ; "v1i1 SETCC" correctly, these test cases are not needed.
10
11 define i64 @test_sext_extr_cmp_0(<1 x i64> %v1, <1 x i64> %v2) {
12 ; CHECK-LABEL: test_sext_extr_cmp_0:
13 ; CHECK: cmge d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}
14   %1 = icmp sge <1 x i64> %v1, %v2
15   %2 = extractelement <1 x i1> %1, i32 0
16   %vget_lane = sext i1 %2 to i64
17   ret i64 %vget_lane
18 }
19
20 define i64 @test_sext_extr_cmp_1(<1 x double> %v1, <1 x double> %v2) {
21 ; CHECK-LABEL: test_sext_extr_cmp_1:
22 ; CHECK: fcmeq d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}
23   %1 = fcmp oeq <1 x double> %v1, %v2
24   %2 = extractelement <1 x i1> %1, i32 0
25   %vget_lane = sext i1 %2 to i64
26   ret i64 %vget_lane
27 }
28
29 define <1 x i64> @test_select_v1i1_0(<1 x i64> %v1, <1 x i64> %v2, <1 x i64> %v3) {
30 ; CHECK-LABEL: test_select_v1i1_0:
31 ; CHECK: cmeq d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}
32 ; CHECK: bsl v{{[0-9]+}}.8b, v{{[0-9]+}}.8b, v{{[0-9]+}}.8b
33   %1 = icmp eq <1 x i64> %v1, %v2
34   %res = select <1 x i1> %1, <1 x i64> zeroinitializer, <1 x i64> %v3
35   ret <1 x i64> %res
36 }
37
38 define <1 x i64> @test_select_v1i1_1(<1 x double> %v1, <1 x double> %v2, <1 x i64> %v3) {
39 ; CHECK-LABEL: test_select_v1i1_1:
40 ; CHECK: fcmeq d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}
41 ; CHECK: bsl v{{[0-9]+}}.8b, v{{[0-9]+}}.8b, v{{[0-9]+}}.8b
42   %1 = fcmp oeq <1 x double> %v1, %v2
43   %res = select <1 x i1> %1, <1 x i64> zeroinitializer, <1 x i64> %v3
44   ret <1 x i64> %res
45 }
46
47 define <1 x double> @test_select_v1i1_2(<1 x i64> %v1, <1 x i64> %v2, <1 x double> %v3) {
48 ; CHECK-LABEL: test_select_v1i1_2:
49 ; CHECK: cmeq d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}
50 ; CHECK: bsl v{{[0-9]+}}.8b, v{{[0-9]+}}.8b, v{{[0-9]+}}.8b
51   %1 = icmp eq <1 x i64> %v1, %v2
52   %res = select <1 x i1> %1, <1 x double> zeroinitializer, <1 x double> %v3
53   ret <1 x double> %res
54 }
55
56 define i32 @test_br_extr_cmp(<1 x i64> %v1, <1 x i64> %v2) {
57 ; CHECK-LABEL: test_br_extr_cmp:
58 ; CHECK: cmp x{{[0-9]+}}, x{{[0-9]+}}
59   %1 = icmp eq <1 x i64> %v1, %v2
60   %2 = extractelement <1 x i1> %1, i32 0
61   br i1 %2, label %if.end, label %if.then
62
63 if.then:
64   ret i32 0;
65
66 if.end:
67   ret i32 1;
68 }