xref: /llvm-project/llvm/test/CodeGen/DirectX/smax.ll (revision 011b618644113996e2c0a8e57db40f89d20878e3)
1cdfd884bSS. Bharadwaj Yadavalli; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
28386a388SFarzon Lotfi
38386a388SFarzon Lotfi; Make sure dxil operation function calls for smax are generated for i16/i32/i64.
48386a388SFarzon Lotfi
58386a388SFarzon Lotfi; CHECK-LABEL:test_smax_i16
68386a388SFarzon Lotfidefine noundef i16 @test_smax_i16(i16 noundef %a, i16 noundef %b) {
78386a388SFarzon Lotfientry:
8*011b6186SFinn Plummer; CHECK: call i16 @dx.op.binary.i16(i32 37, i16 %{{.*}}, i16 %{{.*}}) #[[#ATTR:]]
98386a388SFarzon Lotfi  %0 = call i16 @llvm.smax.i16(i16 %a, i16 %b)
108386a388SFarzon Lotfi  ret i16 %0
118386a388SFarzon Lotfi}
128386a388SFarzon Lotfi
138386a388SFarzon Lotfi; CHECK-LABEL:test_smax_i32
148386a388SFarzon Lotfidefine noundef i32 @test_smax_i32(i32 noundef %a, i32 noundef %b) {
158386a388SFarzon Lotfientry:
16*011b6186SFinn Plummer; CHECK: call i32 @dx.op.binary.i32(i32 37, i32 %{{.*}}, i32 %{{.*}}) #[[#ATTR]]
178386a388SFarzon Lotfi  %0 = call i32 @llvm.smax.i32(i32 %a, i32 %b)
188386a388SFarzon Lotfi  ret i32 %0
198386a388SFarzon Lotfi}
208386a388SFarzon Lotfi
218386a388SFarzon Lotfi; CHECK-LABEL:test_smax_i64
228386a388SFarzon Lotfidefine noundef i64 @test_smax_i64(i64 noundef %a, i64 noundef %b) {
238386a388SFarzon Lotfientry:
24*011b6186SFinn Plummer; CHECK: call i64 @dx.op.binary.i64(i32 37, i64 %{{.*}}, i64 %{{.*}}) #[[#ATTR]]
258386a388SFarzon Lotfi  %0 = call i64 @llvm.smax.i64(i64 %a, i64 %b)
268386a388SFarzon Lotfi  ret i64 %0
278386a388SFarzon Lotfi}
288386a388SFarzon Lotfi
29*011b6186SFinn Plummer; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}
30*011b6186SFinn Plummer
318386a388SFarzon Lotfideclare i16 @llvm.smax.i16(i16, i16)
328386a388SFarzon Lotfideclare i32 @llvm.smax.i32(i32, i32)
338386a388SFarzon Lotfideclare i64 @llvm.smax.i64(i64, i64)
34