Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / AArch64 / fpm-helpers.c
blob4bced01d5c71fa987c9128d6880fee2389878e02
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
3 // RUN: %clang_cc1 -O2 -triple aarch64 -emit-llvm -x c -DUSE_NEON_H %s -o - | FileCheck %s
4 // RUN: %clang_cc1 -O2 -triple aarch64 -emit-llvm -x c -DUSE_SVE_H %s -o - | FileCheck %s
5 // RUN: %clang_cc1 -O2 -triple aarch64 -emit-llvm -x c -DUSE_SME_H %s -o - | FileCheck %s
6 // RUN: %clang_cc1 -O2 -triple aarch64 -emit-llvm -x c++ -DUSE_NEON_H %s -o - | FileCheck %s
7 // RUN: %clang_cc1 -O2 -triple aarch64 -emit-llvm -x c++ -DUSE_SVE_H %s -o - | FileCheck %s
8 // RUN: %clang_cc1 -O2 -triple aarch64 -emit-llvm -x c++ -DUSE_SME_H %s -o - | FileCheck %s
10 // REQUIRES: aarch64-registered-target
12 #ifdef USE_NEON_H
13 #include "arm_neon.h"
14 #endif
16 #ifdef USE_SVE_H
17 #include "arm_sve.h"
18 #endif
20 #ifdef USE_SME_H
21 #include "arm_sme.h"
22 #endif
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 #define INIT_ZERO 0
29 #define INIT_ONES 0xffffffffffffffffU
31 // CHECK-LABEL: define dso_local noundef i64 @test_init(
32 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0:[0-9]+]] {
33 // CHECK-NEXT: [[ENTRY:.*:]]
34 // CHECK-NEXT: ret i64 0
36 fpm_t test_init() { return __arm_fpm_init(); }
38 // CHECK-LABEL: define dso_local noundef i64 @test_src1_1(
39 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
40 // CHECK-NEXT: [[ENTRY:.*:]]
41 // CHECK-NEXT: ret i64 -8
43 fpm_t test_src1_1() {
44 return __arm_set_fpm_src1_format(INIT_ONES, __ARM_FPM_E5M2);
47 // CHECK-LABEL: define dso_local noundef i64 @test_src1_2(
48 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
49 // CHECK-NEXT: [[ENTRY:.*:]]
50 // CHECK-NEXT: ret i64 1
52 fpm_t test_src1_2() {
53 return __arm_set_fpm_src1_format(INIT_ZERO, __ARM_FPM_E4M3);
56 // CHECK-LABEL: define dso_local noundef i64 @test_src2_1(
57 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
58 // CHECK-NEXT: [[ENTRY:.*:]]
59 // CHECK-NEXT: ret i64 -57
61 fpm_t test_src2_1() {
62 return __arm_set_fpm_src2_format(INIT_ONES, __ARM_FPM_E5M2);
65 // CHECK-LABEL: define dso_local noundef i64 @test_src2_2(
66 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
67 // CHECK-NEXT: [[ENTRY:.*:]]
68 // CHECK-NEXT: ret i64 8
70 fpm_t test_src2_2() {
71 return __arm_set_fpm_src2_format(INIT_ZERO, __ARM_FPM_E4M3);
74 // CHECK-LABEL: define dso_local noundef i64 @test_dst1_1(
75 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
76 // CHECK-NEXT: [[ENTRY:.*:]]
77 // CHECK-NEXT: ret i64 -449
79 fpm_t test_dst1_1() {
80 return __arm_set_fpm_dst_format(INIT_ONES, __ARM_FPM_E5M2);
83 // CHECK-LABEL: define dso_local noundef i64 @test_dst2_2(
84 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
85 // CHECK-NEXT: [[ENTRY:.*:]]
86 // CHECK-NEXT: ret i64 64
88 fpm_t test_dst2_2() {
89 return __arm_set_fpm_dst_format(INIT_ZERO, __ARM_FPM_E4M3);
92 // CHECK-LABEL: define dso_local noundef i64 @test_of_mul_1(
93 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
94 // CHECK-NEXT: [[ENTRY:.*:]]
95 // CHECK-NEXT: ret i64 -16385
97 fpm_t test_of_mul_1() {
98 return __arm_set_fpm_overflow_mul(INIT_ONES, __ARM_FPM_INFNAN);
101 // CHECK-LABEL: define dso_local noundef i64 @test_of_mul_2(
102 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
103 // CHECK-NEXT: [[ENTRY:.*:]]
104 // CHECK-NEXT: ret i64 16384
106 fpm_t test_of_mul_2() {
107 return __arm_set_fpm_overflow_mul(INIT_ZERO, __ARM_FPM_SATURATE);
110 // CHECK-LABEL: define dso_local noundef i64 @test_of_cvt_1(
111 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
112 // CHECK-NEXT: [[ENTRY:.*:]]
113 // CHECK-NEXT: ret i64 -32769
115 fpm_t test_of_cvt_1() {
116 return __arm_set_fpm_overflow_cvt(INIT_ONES, __ARM_FPM_INFNAN);
119 // CHECK-LABEL: define dso_local noundef i64 @test_of_cvt_2(
120 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
121 // CHECK-NEXT: [[ENTRY:.*:]]
122 // CHECK-NEXT: ret i64 32768
124 fpm_t test_of_cvt_2() {
125 return __arm_set_fpm_overflow_cvt(INIT_ZERO, __ARM_FPM_SATURATE);
128 // CHECK-LABEL: define dso_local noundef i64 @test_lscale(
129 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
130 // CHECK-NEXT: [[ENTRY:.*:]]
131 // CHECK-NEXT: ret i64 8323072
133 fpm_t test_lscale() { return __arm_set_fpm_lscale(INIT_ZERO, 127); }
135 // CHECK-LABEL: define dso_local noundef i64 @test_lscale2(
136 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
137 // CHECK-NEXT: [[ENTRY:.*:]]
138 // CHECK-NEXT: ret i64 270582939648
140 fpm_t test_lscale2() { return __arm_set_fpm_lscale2(INIT_ZERO, 63); }
142 // CHECK-LABEL: define dso_local noundef range(i64 0, 4294967296) i64 @test_nscale_1(
143 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
144 // CHECK-NEXT: [[ENTRY:.*:]]
145 // CHECK-NEXT: ret i64 2147483648
147 fpm_t test_nscale_1() { return __arm_set_fpm_nscale(INIT_ZERO, -128); }
149 // CHECK-LABEL: define dso_local noundef range(i64 0, 4294967296) i64 @test_nscale_2(
150 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
151 // CHECK-NEXT: [[ENTRY:.*:]]
152 // CHECK-NEXT: ret i64 2130706432
154 fpm_t test_nscale_2() { return __arm_set_fpm_nscale(INIT_ZERO, 127); }
156 // CHECK-LABEL: define dso_local noundef range(i64 0, 4294967296) i64 @test_nscale_3(
157 // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] {
158 // CHECK-NEXT: [[ENTRY:.*:]]
159 // CHECK-NEXT: ret i64 4278190080
161 fpm_t test_nscale_3() { return __arm_set_fpm_nscale(INIT_ZERO, -1); }
163 #ifdef __cplusplus
165 #endif