xref: /llvm-project/clang/test/CodeGen/LoongArch/builtin-flt-approximate.c (revision fcb8342a219ada8ec641790a4c8a9f969d7d64ee)
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 4
2 // RUN: %clang_cc1 -triple loongarch32 -target-feature +f -target-feature +frecipe -O2 -emit-llvm %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -triple loongarch64 -target-feature +f -target-feature +frecipe -O2 -emit-llvm %s -o - | FileCheck %s
4 
5 #include <larchintrin.h>
6 
7 // CHECK-LABEL: @frecipe_s
8 // CHECK-NEXT:  entry:
9 // CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.loongarch.frecipe.s(float [[A:%.*]])
10 // CHECK-NEXT:    ret float [[TMP0]]
11 //
frecipe_s(float _1)12 float frecipe_s (float _1)
13 {
14   return __builtin_loongarch_frecipe_s (_1);
15 }
16 
17 // CHECK-LABEL: @frsqrte_s
18 // CHECK-NEXT:  entry:
19 // CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.loongarch.frsqrte.s(float [[A:%.*]])
20 // CHECK-NEXT:    ret float [[TMP0]]
21 //
frsqrte_s(float _1)22 float frsqrte_s (float _1)
23 {
24   return __builtin_loongarch_frsqrte_s (_1);
25 }
26 
27 // CHECK-LABEL: @frecipe_s_alia
28 // CHECK-NEXT:  entry:
29 // CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.loongarch.frecipe.s(float [[A:%.*]])
30 // CHECK-NEXT:    ret float [[TMP0]]
31 //
frecipe_s_alia(float _1)32 float frecipe_s_alia (float _1)
33 {
34   return __frecipe_s (_1);
35 }
36 
37 // CHECK-LABEL: @frsqrte_s_alia
38 // CHECK-NEXT:  entry:
39 // CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.loongarch.frsqrte.s(float [[A:%.*]])
40 // CHECK-NEXT:    ret float [[TMP0]]
41 //
frsqrte_s_alia(float _1)42 float frsqrte_s_alia (float _1)
43 {
44   return __frsqrte_s (_1);
45 }
46