1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -S -mtriple=amdgcn-- -passes=amdgpu-usenative -amdgpu-use-native=all < %s | FileCheck %s
4 ; Verify nobuiltin is respected on a defined function. native_cos is
5 ; marked nobuiltin, but native_sin is not.
7 define float @_Z10native_sinf(float %x) {
8 ; CHECK-LABEL: define float @_Z10native_sinf
9 ; CHECK-SAME: (float [[X:%.*]]) {
10 ; CHECK-NEXT: [[RESULT:%.*]] = call float asm "
11 ; CHECK-NEXT: ret float [[RESULT]]
13 %result = call float asm "; $0 = native_sin($1)", "=v,v"(float %x)
17 define float @_Z10native_cosf(float %x) nobuiltin {
18 ; CHECK-LABEL: define float @_Z10native_cosf
19 ; CHECK-SAME: (float [[X:%.*]]) #[[ATTR0:[0-9]+]] {
20 ; CHECK-NEXT: [[RESULT:%.*]] = call float asm "
21 ; CHECK-NEXT: ret float [[RESULT]]
23 %result = call float asm "; $0 = native_cos($1)", "=v,v"(float %x)
27 define float @_Z3sinf(float %x) {
28 ; CHECK-LABEL: define float @_Z3sinf
29 ; CHECK-SAME: (float [[X:%.*]]) {
30 ; CHECK-NEXT: [[RESULT:%.*]] = call float asm "
31 ; CHECK-NEXT: ret float [[RESULT]]
33 %result = call float asm "; $0 = sin($1)", "=v,v"(float %x)
37 define float @_Z3cosf(float %x) {
38 ; CHECK-LABEL: define float @_Z3cosf
39 ; CHECK-SAME: (float [[X:%.*]]) {
40 ; CHECK-NEXT: [[RESULT:%.*]] = call float asm "
41 ; CHECK-NEXT: ret float [[RESULT]]
43 %result = call float asm "; $0 = cos($1)", "=v,v"(float %x)
47 define float @call_cos(float %x) {
48 ; CHECK-LABEL: define float @call_cos
49 ; CHECK-SAME: (float [[X:%.*]]) {
50 ; CHECK-NEXT: [[RESULT:%.*]] = call float @_Z3cosf(float [[X]])
51 ; CHECK-NEXT: ret float [[RESULT]]
53 %result = call float @_Z3cosf(float %x)
57 define float @call_sin(float %x) {
58 ; CHECK-LABEL: define float @call_sin
59 ; CHECK-SAME: (float [[X:%.*]]) {
60 ; CHECK-NEXT: [[RESULT:%.*]] = call float @_Z10native_sinf(float [[X]])
61 ; CHECK-NEXT: ret float [[RESULT]]
63 %result = call float @_Z3sinf(float %x)