xref: /llvm-project/llvm/test/CodeGen/DirectX/fmin.ll (revision 011b618644113996e2c0a8e57db40f89d20878e3)
1; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
2
3; Make sure dxil operation function calls for fmin are generated for half/float/double.
4
5; CHECK-LABEL:test_fmin_half
6define noundef half @test_fmin_half(half noundef %a, half noundef %b) {
7entry:
8; CHECK: call half @dx.op.binary.f16(i32 36, half %{{.*}}, half %{{.*}}) #[[#ATTR:]]
9  %0 = call half @llvm.minnum.f16(half %a, half %b)
10  ret half %0
11}
12
13; CHECK-LABEL:test_fmin_float
14define noundef float @test_fmin_float(float noundef %a, float noundef %b) {
15entry:
16; CHECK: call float @dx.op.binary.f32(i32 36, float %{{.*}}, float %{{.*}}) #[[#ATTR]]
17  %0 = call float @llvm.minnum.f32(float %a, float %b)
18  ret float %0
19}
20
21; CHECK-LABEL:test_fmin_double
22define noundef double @test_fmin_double(double noundef %a, double noundef %b) {
23entry:
24; CHECK: call double @dx.op.binary.f64(i32 36, double %{{.*}}, double %{{.*}}) #[[#ATTR]]
25  %0 = call double @llvm.minnum.f64(double %a, double %b)
26  ret double %0
27}
28
29; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}
30
31declare half @llvm.minnum.f16(half, half)
32declare float @llvm.minnum.f32(float, float)
33declare double @llvm.minnum.f64(double, double)
34