xref: /llvm-project/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/cos.ll (revision cf3d6fded9eaf1372ccfde1d49dd91df6762d98c)
1*cf3d6fdeSNathan Gauër; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
282d8a956SFarzon Lotfi; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
382d8a956SFarzon Lotfi
482d8a956SFarzon Lotfi; CHECK: OpExtInstImport "GLSL.std.450"
582d8a956SFarzon Lotfi
682d8a956SFarzon Lotfidefine noundef float @cos_float(float noundef %a) {
782d8a956SFarzon Lotfientry:
882d8a956SFarzon Lotfi; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Cos %[[#]]
982d8a956SFarzon Lotfi  %elt.cos = call float @llvm.cos.f32(float %a)
1082d8a956SFarzon Lotfi  ret float %elt.cos
1182d8a956SFarzon Lotfi}
1282d8a956SFarzon Lotfi
1382d8a956SFarzon Lotfidefine noundef half @cos_half(half noundef %a) {
1482d8a956SFarzon Lotfientry:
1582d8a956SFarzon Lotfi; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Cos %[[#]]
1682d8a956SFarzon Lotfi  %elt.cos = call half @llvm.cos.f16(half %a)
1782d8a956SFarzon Lotfi  ret half %elt.cos
1882d8a956SFarzon Lotfi}
1982d8a956SFarzon Lotfi
2082d8a956SFarzon Lotfideclare half @llvm.cos.f16(half)
2182d8a956SFarzon Lotfideclare float @llvm.cos.f32(float)
22