xref: /llvm-project/clang/test/CodeGen/AArch64/sve-intrinsics/acle_sve_cmpuo.c (revision 207e5ccceec8d3cc3f32723e78f2a142bc61b07d)
1*207e5cccSFangrui Song // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2*207e5cccSFangrui Song // REQUIRES: aarch64-registered-target
3*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s
4*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
5*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s
6*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
7*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sve -S -disable-O0-optnone -Werror -o /dev/null %s
8*207e5cccSFangrui Song // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sme -S -disable-O0-optnone -Werror -o /dev/null %s
9*207e5cccSFangrui Song 
10*207e5cccSFangrui Song #include <arm_sve.h>
11*207e5cccSFangrui Song 
12*207e5cccSFangrui Song #if defined __ARM_FEATURE_SME
13*207e5cccSFangrui Song #define MODE_ATTR __arm_streaming
14*207e5cccSFangrui Song #else
15*207e5cccSFangrui Song #define MODE_ATTR
16*207e5cccSFangrui Song #endif
17*207e5cccSFangrui Song 
18*207e5cccSFangrui Song #ifdef SVE_OVERLOADED_FORMS
19*207e5cccSFangrui Song // A simple used,unused... macro, long enough to represent any SVE builtin.
20*207e5cccSFangrui Song #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
21*207e5cccSFangrui Song #else
22*207e5cccSFangrui Song #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
23*207e5cccSFangrui Song #endif
24*207e5cccSFangrui Song 
25*207e5cccSFangrui Song // CHECK-LABEL: @test_svcmpuo_f16(
26*207e5cccSFangrui Song // CHECK-NEXT:  entry:
27*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]])
28*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.fcmpuo.nxv8f16(<vscale x 8 x i1> [[TMP0]], <vscale x 8 x half> [[OP1:%.*]], <vscale x 8 x half> [[OP2:%.*]])
29*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> [[TMP1]])
30*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
31*207e5cccSFangrui Song //
32*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z16test_svcmpuo_f16u10__SVBool_tu13__SVFloat16_tS0_(
33*207e5cccSFangrui Song // CPP-CHECK-NEXT:  entry:
34*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]])
35*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.fcmpuo.nxv8f16(<vscale x 8 x i1> [[TMP0]], <vscale x 8 x half> [[OP1:%.*]], <vscale x 8 x half> [[OP2:%.*]])
36*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> [[TMP1]])
37*207e5cccSFangrui Song // CPP-CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
38*207e5cccSFangrui Song //
39*207e5cccSFangrui Song svbool_t test_svcmpuo_f16(svbool_t pg, svfloat16_t op1, svfloat16_t op2) MODE_ATTR
40*207e5cccSFangrui Song {
41*207e5cccSFangrui Song   return SVE_ACLE_FUNC(svcmpuo,_f16,,)(pg, op1, op2);
42*207e5cccSFangrui Song }
43*207e5cccSFangrui Song 
44*207e5cccSFangrui Song // CHECK-LABEL: @test_svcmpuo_f32(
45*207e5cccSFangrui Song // CHECK-NEXT:  entry:
46*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> [[PG:%.*]])
47*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.fcmpuo.nxv4f32(<vscale x 4 x i1> [[TMP0]], <vscale x 4 x float> [[OP1:%.*]], <vscale x 4 x float> [[OP2:%.*]])
48*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> [[TMP1]])
49*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
50*207e5cccSFangrui Song //
51*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z16test_svcmpuo_f32u10__SVBool_tu13__SVFloat32_tS0_(
52*207e5cccSFangrui Song // CPP-CHECK-NEXT:  entry:
53*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> [[PG:%.*]])
54*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.fcmpuo.nxv4f32(<vscale x 4 x i1> [[TMP0]], <vscale x 4 x float> [[OP1:%.*]], <vscale x 4 x float> [[OP2:%.*]])
55*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> [[TMP1]])
56*207e5cccSFangrui Song // CPP-CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
57*207e5cccSFangrui Song //
58*207e5cccSFangrui Song svbool_t test_svcmpuo_f32(svbool_t pg, svfloat32_t op1, svfloat32_t op2) MODE_ATTR
59*207e5cccSFangrui Song {
60*207e5cccSFangrui Song   return SVE_ACLE_FUNC(svcmpuo,_f32,,)(pg, op1, op2);
61*207e5cccSFangrui Song }
62*207e5cccSFangrui Song 
63*207e5cccSFangrui Song // CHECK-LABEL: @test_svcmpuo_f64(
64*207e5cccSFangrui Song // CHECK-NEXT:  entry:
65*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> [[PG:%.*]])
66*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.fcmpuo.nxv2f64(<vscale x 2 x i1> [[TMP0]], <vscale x 2 x double> [[OP1:%.*]], <vscale x 2 x double> [[OP2:%.*]])
67*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> [[TMP1]])
68*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
69*207e5cccSFangrui Song //
70*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z16test_svcmpuo_f64u10__SVBool_tu13__SVFloat64_tS0_(
71*207e5cccSFangrui Song // CPP-CHECK-NEXT:  entry:
72*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> [[PG:%.*]])
73*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.fcmpuo.nxv2f64(<vscale x 2 x i1> [[TMP0]], <vscale x 2 x double> [[OP1:%.*]], <vscale x 2 x double> [[OP2:%.*]])
74*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> [[TMP1]])
75*207e5cccSFangrui Song // CPP-CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
76*207e5cccSFangrui Song //
77*207e5cccSFangrui Song svbool_t test_svcmpuo_f64(svbool_t pg, svfloat64_t op1, svfloat64_t op2) MODE_ATTR
78*207e5cccSFangrui Song {
79*207e5cccSFangrui Song   return SVE_ACLE_FUNC(svcmpuo,_f64,,)(pg, op1, op2);
80*207e5cccSFangrui Song }
81*207e5cccSFangrui Song 
82*207e5cccSFangrui Song // CHECK-LABEL: @test_svcmpuo_n_f16(
83*207e5cccSFangrui Song // CHECK-NEXT:  entry:
84*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]])
85*207e5cccSFangrui Song // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x half> poison, half [[OP2:%.*]], i64 0
86*207e5cccSFangrui Song // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x half> [[DOTSPLATINSERT]], <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
87*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.fcmpuo.nxv8f16(<vscale x 8 x i1> [[TMP0]], <vscale x 8 x half> [[OP1:%.*]], <vscale x 8 x half> [[DOTSPLAT]])
88*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> [[TMP1]])
89*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
90*207e5cccSFangrui Song //
91*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z18test_svcmpuo_n_f16u10__SVBool_tu13__SVFloat16_tDh(
92*207e5cccSFangrui Song // CPP-CHECK-NEXT:  entry:
93*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> [[PG:%.*]])
94*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x half> poison, half [[OP2:%.*]], i64 0
95*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x half> [[DOTSPLATINSERT]], <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
96*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.fcmpuo.nxv8f16(<vscale x 8 x i1> [[TMP0]], <vscale x 8 x half> [[OP1:%.*]], <vscale x 8 x half> [[DOTSPLAT]])
97*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> [[TMP1]])
98*207e5cccSFangrui Song // CPP-CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
99*207e5cccSFangrui Song //
100*207e5cccSFangrui Song svbool_t test_svcmpuo_n_f16(svbool_t pg, svfloat16_t op1, float16_t op2) MODE_ATTR
101*207e5cccSFangrui Song {
102*207e5cccSFangrui Song   return SVE_ACLE_FUNC(svcmpuo,_n_f16,,)(pg, op1, op2);
103*207e5cccSFangrui Song }
104*207e5cccSFangrui Song 
105*207e5cccSFangrui Song // CHECK-LABEL: @test_svcmpuo_n_f32(
106*207e5cccSFangrui Song // CHECK-NEXT:  entry:
107*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> [[PG:%.*]])
108*207e5cccSFangrui Song // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[OP2:%.*]], i64 0
109*207e5cccSFangrui Song // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <vscale x 4 x float> [[DOTSPLATINSERT]], <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
110*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.fcmpuo.nxv4f32(<vscale x 4 x i1> [[TMP0]], <vscale x 4 x float> [[OP1:%.*]], <vscale x 4 x float> [[DOTSPLAT]])
111*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> [[TMP1]])
112*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
113*207e5cccSFangrui Song //
114*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z18test_svcmpuo_n_f32u10__SVBool_tu13__SVFloat32_tf(
115*207e5cccSFangrui Song // CPP-CHECK-NEXT:  entry:
116*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> [[PG:%.*]])
117*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x float> poison, float [[OP2:%.*]], i64 0
118*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <vscale x 4 x float> [[DOTSPLATINSERT]], <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
119*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.fcmpuo.nxv4f32(<vscale x 4 x i1> [[TMP0]], <vscale x 4 x float> [[OP1:%.*]], <vscale x 4 x float> [[DOTSPLAT]])
120*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> [[TMP1]])
121*207e5cccSFangrui Song // CPP-CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
122*207e5cccSFangrui Song //
123*207e5cccSFangrui Song svbool_t test_svcmpuo_n_f32(svbool_t pg, svfloat32_t op1, float32_t op2) MODE_ATTR
124*207e5cccSFangrui Song {
125*207e5cccSFangrui Song   return SVE_ACLE_FUNC(svcmpuo,_n_f32,,)(pg, op1, op2);
126*207e5cccSFangrui Song }
127*207e5cccSFangrui Song 
128*207e5cccSFangrui Song // CHECK-LABEL: @test_svcmpuo_n_f64(
129*207e5cccSFangrui Song // CHECK-NEXT:  entry:
130*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> [[PG:%.*]])
131*207e5cccSFangrui Song // CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 2 x double> poison, double [[OP2:%.*]], i64 0
132*207e5cccSFangrui Song // CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <vscale x 2 x double> [[DOTSPLATINSERT]], <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
133*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.fcmpuo.nxv2f64(<vscale x 2 x i1> [[TMP0]], <vscale x 2 x double> [[OP1:%.*]], <vscale x 2 x double> [[DOTSPLAT]])
134*207e5cccSFangrui Song // CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> [[TMP1]])
135*207e5cccSFangrui Song // CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
136*207e5cccSFangrui Song //
137*207e5cccSFangrui Song // CPP-CHECK-LABEL: @_Z18test_svcmpuo_n_f64u10__SVBool_tu13__SVFloat64_td(
138*207e5cccSFangrui Song // CPP-CHECK-NEXT:  entry:
139*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP0:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> [[PG:%.*]])
140*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 2 x double> poison, double [[OP2:%.*]], i64 0
141*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <vscale x 2 x double> [[DOTSPLATINSERT]], <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
142*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP1:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.fcmpuo.nxv2f64(<vscale x 2 x i1> [[TMP0]], <vscale x 2 x double> [[OP1:%.*]], <vscale x 2 x double> [[DOTSPLAT]])
143*207e5cccSFangrui Song // CPP-CHECK-NEXT:    [[TMP2:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> [[TMP1]])
144*207e5cccSFangrui Song // CPP-CHECK-NEXT:    ret <vscale x 16 x i1> [[TMP2]]
145*207e5cccSFangrui Song //
146*207e5cccSFangrui Song svbool_t test_svcmpuo_n_f64(svbool_t pg, svfloat64_t op1, float64_t op2) MODE_ATTR
147*207e5cccSFangrui Song {
148*207e5cccSFangrui Song   return SVE_ACLE_FUNC(svcmpuo,_n_f64,,)(pg, op1, op2);
149*207e5cccSFangrui Song }
150