xref: /llvm-project/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/fmin.ll (revision cf3d6fded9eaf1372ccfde1d49dd91df6762d98c)
1; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4; CHECK: OpExtInstImport "GLSL.std.450"
5; CHECK: OpMemoryModel Logical GLSL450
6
7define noundef half @test_fmax_half(half noundef %a, half noundef %b) {
8entry:
9; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] NMin %[[#]] %[[#]]
10  %0 = call half @llvm.minnum.f16(half %a, half %b)
11  ret half %0
12}
13
14define noundef float @test_fmax_float(float noundef %a, float noundef %b) {
15entry:
16; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] NMin %[[#]] %[[#]]
17  %0 = call float @llvm.minnum.f32(float %a, float %b)
18  ret float %0
19}
20
21define noundef double @test_fmax_double(double noundef %a, double noundef %b) {
22entry:
23; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] NMin %[[#]] %[[#]]
24  %0 = call double @llvm.minnum.f64(double %a, double %b)
25  ret double %0
26}
27
28declare half @llvm.minnum.f16(half, half)
29declare float @llvm.minnum.f32(float, float)
30declare double @llvm.minnum.f64(double, double)
31