66 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; RUN: opt -S -mtriple=amdgcn-- -passes=amdgpu-usenative -amdgpu-use-native=all < %s | FileCheck %s3 4; Verify nobuiltin is respected on a defined function. native_cos is5; marked nobuiltin, but native_sin is not.6 7define float @_Z10native_sinf(float %x) {8; CHECK-LABEL: define float @_Z10native_sinf9; CHECK-SAME: (float [[X:%.*]]) {10; CHECK-NEXT: [[RESULT:%.*]] = call float asm "11; CHECK-NEXT: ret float [[RESULT]]12;13 %result = call float asm "; $0 = native_sin($1)", "=v,v"(float %x)14 ret float %result15}16 17define float @_Z10native_cosf(float %x) nobuiltin {18; CHECK-LABEL: define float @_Z10native_cosf19; CHECK-SAME: (float [[X:%.*]]) #[[ATTR0:[0-9]+]] {20; CHECK-NEXT: [[RESULT:%.*]] = call float asm "21; CHECK-NEXT: ret float [[RESULT]]22;23 %result = call float asm "; $0 = native_cos($1)", "=v,v"(float %x)24 ret float %result25}26 27define float @_Z3sinf(float %x) {28; CHECK-LABEL: define float @_Z3sinf29; CHECK-SAME: (float [[X:%.*]]) {30; CHECK-NEXT: [[RESULT:%.*]] = call float asm "31; CHECK-NEXT: ret float [[RESULT]]32;33 %result = call float asm "; $0 = sin($1)", "=v,v"(float %x)34 ret float %result35}36 37define float @_Z3cosf(float %x) {38; CHECK-LABEL: define float @_Z3cosf39; CHECK-SAME: (float [[X:%.*]]) {40; CHECK-NEXT: [[RESULT:%.*]] = call float asm "41; CHECK-NEXT: ret float [[RESULT]]42;43 %result = call float asm "; $0 = cos($1)", "=v,v"(float %x)44 ret float %result45}46 47define float @call_cos(float %x) {48; CHECK-LABEL: define float @call_cos49; CHECK-SAME: (float [[X:%.*]]) {50; CHECK-NEXT: [[RESULT:%.*]] = call float @_Z3cosf(float [[X]])51; CHECK-NEXT: ret float [[RESULT]]52;53 %result = call float @_Z3cosf(float %x)54 ret float %result55}56 57define float @call_sin(float %x) {58; CHECK-LABEL: define float @call_sin59; CHECK-SAME: (float [[X:%.*]]) {60; CHECK-NEXT: [[RESULT:%.*]] = call float @_Z10native_sinf(float [[X]])61; CHECK-NEXT: ret float [[RESULT]]62;63 %result = call float @_Z3sinf(float %x)64 ret float %result65}66