brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 262f198 Raw
57 lines · plain
1; RUN: opt -S  -dxil-intrinsic-expansion  < %s | FileCheck %s2 3; Make sure dxil operation function calls for cross are generated for half/float.4 5declare <3 x half> @llvm.dx.cross.v3f16(<3 x half>, <3 x half>)6declare <3 x float> @llvm.dx.cross.v3f32(<3 x float>, <3 x float>)7 8define noundef <3 x half> @test_cross_half3(<3 x half> noundef %p0, <3 x half> noundef %p1) {9entry:10  ; CHECK: %x0 = extractelement <3 x half> %p0, i64 011  ; CHECK: %x1 = extractelement <3 x half> %p0, i64 112  ; CHECK: %x2 = extractelement <3 x half> %p0, i64 213  ; CHECK: %y0 = extractelement <3 x half> %p1, i64 014  ; CHECK: %y1 = extractelement <3 x half> %p1, i64 115  ; CHECK: %y2 = extractelement <3 x half> %p1, i64 216  ; CHECK: %0 = fmul half %x1, %y217  ; CHECK: %1 = fmul half %x2, %y118  ; CHECK: %hlsl.cross1 = fsub half %0, %119  ; CHECK: %2 = fmul half %x2, %y020  ; CHECK: %3 = fmul half %x0, %y221  ; CHECK: %hlsl.cross2 = fsub half %2, %322  ; CHECK: %4 = fmul half %x0, %y123  ; CHECK: %5 = fmul half %x1, %y024  ; CHECK: %hlsl.cross3 = fsub half %4, %525  ; CHECK: %6 = insertelement <3 x half> poison, half %hlsl.cross1, i64 026  ; CHECK: %7 = insertelement <3 x half> %6, half %hlsl.cross2, i64 127  ; CHECK: %8 = insertelement <3 x half> %7, half %hlsl.cross3, i64 228  ; CHECK: ret <3 x half> %829  %hlsl.cross = call <3 x half> @llvm.dx.cross.v3f16(<3 x half> %p0, <3 x half> %p1)30  ret <3 x half> %hlsl.cross31}32 33define noundef <3 x float> @test_cross_float3(<3 x float> noundef %p0, <3 x float> noundef %p1) {34entry:35  ; CHECK: %x0 = extractelement <3 x float> %p0, i64 036  ; CHECK: %x1 = extractelement <3 x float> %p0, i64 137  ; CHECK: %x2 = extractelement <3 x float> %p0, i64 238  ; CHECK: %y0 = extractelement <3 x float> %p1, i64 039  ; CHECK: %y1 = extractelement <3 x float> %p1, i64 140  ; CHECK: %y2 = extractelement <3 x float> %p1, i64 241  ; CHECK: %0 = fmul float %x1, %y242  ; CHECK: %1 = fmul float %x2, %y143  ; CHECK: %hlsl.cross1 = fsub float %0, %144  ; CHECK: %2 = fmul float %x2, %y045  ; CHECK: %3 = fmul float %x0, %y246  ; CHECK: %hlsl.cross2 = fsub float %2, %347  ; CHECK: %4 = fmul float %x0, %y148  ; CHECK: %5 = fmul float %x1, %y049  ; CHECK: %hlsl.cross3 = fsub float %4, %550  ; CHECK: %6 = insertelement <3 x float> poison, float %hlsl.cross1, i64 051  ; CHECK: %7 = insertelement <3 x float> %6, float %hlsl.cross2, i64 152  ; CHECK: %8 = insertelement <3 x float> %7, float %hlsl.cross3, i64 253  ; CHECK: ret <3 x float> %854  %hlsl.cross = call <3 x float> @llvm.dx.cross.v3f32(<3 x float> %p0, <3 x float> %p1)55  ret <3 x float> %hlsl.cross56}57