xref: /llvm-project/clang/test/CodeGen/AArch64/attr-mode-float.c (revision 207e5ccceec8d3cc3f32723e78f2a142bc61b07d)
1*207e5cccSFangrui Song // RUN: %clang_cc1 -triple arm64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s
2*207e5cccSFangrui Song 
3*207e5cccSFangrui Song typedef float f16a __attribute((mode(HF)));
4*207e5cccSFangrui Song typedef double f16b __attribute((mode(HF)));
5*207e5cccSFangrui Song typedef float f32a __attribute((mode(SF)));
6*207e5cccSFangrui Song typedef double f32b __attribute((mode(SF)));
7*207e5cccSFangrui Song typedef float f64a __attribute((mode(DF)));
8*207e5cccSFangrui Song typedef double f64b __attribute((mode(DF)));
9*207e5cccSFangrui Song f16b tmp;
10*207e5cccSFangrui Song 
11*207e5cccSFangrui Song // CHECK: define{{.*}} ptr @f16_test(ptr noundef {{.*}})
12*207e5cccSFangrui Song // CHECK:   store half {{.*}}, ptr @tmp, align 2
13*207e5cccSFangrui Song // CHECK:   ret ptr @tmp
14*207e5cccSFangrui Song f16b *f16_test(f16a *x) {
15*207e5cccSFangrui Song   tmp = *x + *x;
16*207e5cccSFangrui Song   return &tmp;
17*207e5cccSFangrui Song }
18*207e5cccSFangrui Song 
19*207e5cccSFangrui Song // CHECK: define{{.*}} float @f32_test(float noundef {{.*}})
20*207e5cccSFangrui Song // CHECK:   ret float {{.*}}
21*207e5cccSFangrui Song f32b f32_test(f32a x) {
22*207e5cccSFangrui Song   return x + x;
23*207e5cccSFangrui Song }
24*207e5cccSFangrui Song 
25*207e5cccSFangrui Song // CHECK: define{{.*}} double @f64_test(double noundef {{.*}})
26*207e5cccSFangrui Song // CHECK:   ret double {{.*}}
27*207e5cccSFangrui Song f64b f64_test(f64a x) {
28*207e5cccSFangrui Song   return x + x;
29*207e5cccSFangrui Song }
30