xref: /llvm-project/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/fmax.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; CHECK: OpExtInstImport "GLSL.std.450"
4
5define noundef half @test_fmax_half(half noundef %a, half noundef %b) {
6entry:
7; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] NMax %[[#]] %[[#]]
8  %0 = call half @llvm.maxnum.f16(half %a, half %b)
9  ret half %0
10}
11
12define noundef float @test_fmax_float(float noundef %a, float noundef %b) {
13entry:
14; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] NMax %[[#]] %[[#]]
15  %0 = call float @llvm.maxnum.f32(float %a, float %b)
16  ret float %0
17}
18
19define noundef double @test_fmax_double(double noundef %a, double noundef %b) {
20entry:
21; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] NMax %[[#]] %[[#]]
22  %0 = call double @llvm.maxnum.f64(double %a, double %b)
23  ret double %0
24}
25
26declare half @llvm.maxnum.f16(half, half)
27declare float @llvm.maxnum.f32(float, float)
28declare double @llvm.maxnum.f64(double, double)
29