aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/trunc.ll
blob: d72543ae6c6d48301dc59bccf26f3109eeb79a90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-vulkan %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %}

; CHECK: OpExtInstImport "GLSL.std.450"

define noundef float @trunc_float(float noundef %a) {
entry:
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Trunc %[[#]]
  %elt.trunc = call float @llvm.trunc.f32(float %a)
  ret float %elt.trunc
}

define noundef half @trunc_half(half noundef %a) {
entry:
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Trunc %[[#]]
  %elt.trunc = call half @llvm.trunc.f16(half %a)
  ret half %elt.trunc
}

declare half @llvm.trunc.f16(half)
declare float @llvm.trunc.f32(float)