xref: /llvm-project/llvm/test/CodeGen/DirectX/step.ll (revision 381156c130553179fe3499403cf530deb73f1a3f)
12d47a0baSJoshua Batista; RUN: opt -S  -dxil-intrinsic-expansion  < %s | FileCheck %s --check-prefix=CHECK
27d0ca601SFarzon Lotfi; RUN: opt -S  -dxil-intrinsic-expansion -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library < %s | FileCheck %s --check-prefix=CHECK
32d47a0baSJoshua Batista
42d47a0baSJoshua Batista; Make sure dxil operation function calls for step are generated for half/float.
52d47a0baSJoshua Batista
62d47a0baSJoshua Batistadeclare half @llvm.dx.step.f16(half, half)
72d47a0baSJoshua Batistadeclare <2 x half> @llvm.dx.step.v2f16(<2 x half>, <2 x half>)
82d47a0baSJoshua Batistadeclare <3 x half> @llvm.dx.step.v3f16(<3 x half>, <3 x half>)
92d47a0baSJoshua Batistadeclare <4 x half> @llvm.dx.step.v4f16(<4 x half>, <4 x half>)
102d47a0baSJoshua Batista
112d47a0baSJoshua Batistadeclare float @llvm.dx.step.f32(float, float)
122d47a0baSJoshua Batistadeclare <2 x float> @llvm.dx.step.v2f32(<2 x float>, <2 x float>)
132d47a0baSJoshua Batistadeclare <3 x float> @llvm.dx.step.v3f32(<3 x float>, <3 x float>)
142d47a0baSJoshua Batistadeclare <4 x float> @llvm.dx.step.v4f32(<4 x float>, <4 x float>)
152d47a0baSJoshua Batista
162d47a0baSJoshua Batistadefine noundef half @test_step_half(half noundef %p0, half noundef %p1) {
172d47a0baSJoshua Batistaentry:
182d47a0baSJoshua Batista  ; CHECK: %0 = fcmp olt half %p1, %p0
192d47a0baSJoshua Batista  ; CHECK: %1 = select i1 %0, half 0xH0000, half 0xH3C00
202d47a0baSJoshua Batista  %hlsl.step = call half @llvm.dx.step.f16(half %p0, half %p1)
212d47a0baSJoshua Batista  ret half %hlsl.step
222d47a0baSJoshua Batista}
232d47a0baSJoshua Batista
242d47a0baSJoshua Batistadefine noundef <2 x half> @test_step_half2(<2 x half> noundef %p0, <2 x half> noundef %p1) {
252d47a0baSJoshua Batistaentry:
262d47a0baSJoshua Batista  ; CHECK: %0 = fcmp olt <2 x half> %p1, %p0
27*381156c1STex Riddell  ; CHECK: %1 = select <2 x i1> %0, <2 x half> zeroinitializer, <2 x half> splat (half 0xH3C00)
282d47a0baSJoshua Batista  %hlsl.step = call <2 x half> @llvm.dx.step.v2f16(<2 x half> %p0, <2 x half> %p1)
292d47a0baSJoshua Batista  ret <2 x half> %hlsl.step
302d47a0baSJoshua Batista}
312d47a0baSJoshua Batista
322d47a0baSJoshua Batistadefine noundef <3 x half> @test_step_half3(<3 x half> noundef %p0, <3 x half> noundef %p1) {
332d47a0baSJoshua Batistaentry:
342d47a0baSJoshua Batista  ; CHECK: %0 = fcmp olt <3 x half> %p1, %p0
35*381156c1STex Riddell  ; CHECK: %1 = select <3 x i1> %0, <3 x half> zeroinitializer, <3 x half> splat (half 0xH3C00)
362d47a0baSJoshua Batista  %hlsl.step = call <3 x half> @llvm.dx.step.v3f16(<3 x half> %p0, <3 x half> %p1)
372d47a0baSJoshua Batista  ret <3 x half> %hlsl.step
382d47a0baSJoshua Batista}
392d47a0baSJoshua Batista
402d47a0baSJoshua Batistadefine noundef <4 x half> @test_step_half4(<4 x half> noundef %p0, <4 x half> noundef %p1) {
412d47a0baSJoshua Batistaentry:
422d47a0baSJoshua Batista  ; CHECK: %0 = fcmp olt <4 x half> %p1, %p0
43*381156c1STex Riddell  ; CHECK: %1 = select <4 x i1> %0, <4 x half> zeroinitializer, <4 x half> splat (half 0xH3C00)
442d47a0baSJoshua Batista  %hlsl.step = call <4 x half> @llvm.dx.step.v4f16(<4 x half> %p0, <4 x half> %p1)
452d47a0baSJoshua Batista  ret <4 x half> %hlsl.step
462d47a0baSJoshua Batista}
472d47a0baSJoshua Batista
482d47a0baSJoshua Batistadefine noundef float @test_step_float(float noundef %p0, float noundef %p1) {
492d47a0baSJoshua Batistaentry:
502d47a0baSJoshua Batista  ; CHECK: %0 = fcmp olt float %p1, %p0
512d47a0baSJoshua Batista  ; CHECK: %1 = select i1 %0, float 0.000000e+00, float 1.000000e+00
522d47a0baSJoshua Batista  %hlsl.step = call float @llvm.dx.step.f32(float %p0, float %p1)
532d47a0baSJoshua Batista  ret float %hlsl.step
542d47a0baSJoshua Batista}
552d47a0baSJoshua Batista
562d47a0baSJoshua Batistadefine noundef <2 x float> @test_step_float2(<2 x float> noundef %p0, <2 x float> noundef %p1) {
572d47a0baSJoshua Batistaentry:
582d47a0baSJoshua Batista  ; CHECK: %0 = fcmp olt <2 x float> %p1, %p0
59*381156c1STex Riddell  ; CHECK: %1 = select <2 x i1> %0, <2 x float> zeroinitializer, <2 x float> splat (float 1.000000e+00)
602d47a0baSJoshua Batista  %hlsl.step = call <2 x float> @llvm.dx.step.v2f32(<2 x float> %p0, <2 x float> %p1)
612d47a0baSJoshua Batista  ret <2 x float> %hlsl.step
622d47a0baSJoshua Batista}
632d47a0baSJoshua Batista
642d47a0baSJoshua Batistadefine noundef <3 x float> @test_step_float3(<3 x float> noundef %p0, <3 x float> noundef %p1) {
652d47a0baSJoshua Batistaentry:
662d47a0baSJoshua Batista  ; CHECK: %0 = fcmp olt <3 x float> %p1, %p0
67*381156c1STex Riddell  ; CHECK: %1 = select <3 x i1> %0, <3 x float> zeroinitializer, <3 x float> splat (float 1.000000e+00)
682d47a0baSJoshua Batista  %hlsl.step = call <3 x float> @llvm.dx.step.v3f32(<3 x float> %p0, <3 x float> %p1)
692d47a0baSJoshua Batista  ret <3 x float> %hlsl.step
702d47a0baSJoshua Batista}
712d47a0baSJoshua Batista
722d47a0baSJoshua Batistadefine noundef <4 x float> @test_step_float4(<4 x float> noundef %p0, <4 x float> noundef %p1) {
732d47a0baSJoshua Batistaentry:
742d47a0baSJoshua Batista  ; CHECK: %0 = fcmp olt <4 x float> %p1, %p0
75*381156c1STex Riddell  ; CHECK: %1 = select <4 x i1> %0, <4 x float> zeroinitializer, <4 x float> splat (float 1.000000e+00)
762d47a0baSJoshua Batista  %hlsl.step = call <4 x float> @llvm.dx.step.v4f32(<4 x float> %p0, <4 x float> %p1)
772d47a0baSJoshua Batista  ret <4 x float> %hlsl.step
782d47a0baSJoshua Batista}
79