diff --git a/crates/metal2vulkan/tests/air_input/quad_helpers.txt b/crates/metal2vulkan/tests/air_input/quad_helpers.txt new file mode 100644 index 000000000..6d18ee8e7 --- /dev/null +++ b/crates/metal2vulkan/tests/air_input/quad_helpers.txt @@ -0,0 +1,801 @@ +target triple = "air64_v28-apple-macosx26.0.0" +source_filename = "-" +; datalayout DataLayout { endian: Little, pointers: {0: PointerSpec { size_bits: 64, abi_bits: 64, pref_bits: 64, index_bits: 64 }}, ints: {1: AlignSpec { abi_bits: 8, pref_bits: 8 }, 8: AlignSpec { abi_bits: 8, pref_bits: 8 }, 16: AlignSpec { abi_bits: 16, pref_bits: 16 }, 32: AlignSpec { abi_bits: 32, pref_bits: 32 }, 64: AlignSpec { abi_bits: 64, pref_bits: 64 }}, floats: {16: AlignSpec { abi_bits: 16, pref_bits: 16 }, 32: AlignSpec { abi_bits: 32, pref_bits: 32 }, 64: AlignSpec { abi_bits: 64, pref_bits: 64 }, 128: AlignSpec { abi_bits: 128, pref_bits: 128 }}, vectors: {16: AlignSpec { abi_bits: 16, pref_bits: 16 }, 24: AlignSpec { abi_bits: 32, pref_bits: 32 }, 32: AlignSpec { abi_bits: 32, pref_bits: 32 }, 48: AlignSpec { abi_bits: 64, pref_bits: 64 }, 64: AlignSpec { abi_bits: 64, pref_bits: 64 }, 96: AlignSpec { abi_bits: 128, pref_bits: 128 }, 128: AlignSpec { abi_bits: 128, pref_bits: 128 }, 192: AlignSpec { abi_bits: 256, pref_bits: 256 }, 256: AlignSpec { abi_bits: 256, pref_bits: 256 }, 512: AlignSpec { abi_bits: 512, pref_bits: 512 }, 1024: AlignSpec { abi_bits: 1024, pref_bits: 1024 }}, aggregate: AlignSpec { abi_bits: 0, pref_bits: 64 }, native_ints: [8, 16, 32], stack_align_bits: None, alloca_space: 0, program_space: 0, globals_space: 0, mangling: None, fn_ptr_align: None, non_integral: [] } +%t3 = type <{ <4 x float> }> +%t5 = type %t3 (i32) +%t6 = type float (i32) +%t9 = type <4 x float> (<4 x float>, i16, ptr addrspace(1)) +%t12 = type <2 x i32> (<2 x float>) +%t14 = type float (i1) +%t15 = type <4 x float> (<4 x float>, ptr addrspace(1)) +%t16 = type i1 (i1) +%t17 = type i1 () +%t18 = type float (i16) +%t19 = type float (float) +%t20 = type i16 (i1) +%t21 = type i16 () +%t22 = type i32 (i32) +%t24 = type i64 (i1) +%t25 = type i64 () +%t28 = type [2 x i32] +%t29 = type [3 x <2 x float>] +c36 = %t28 [27, 2] +c54 = <2 x float> [0x3FA66666, 0x3F333333] +c56 = <2 x float> [0x40D33333, 0x3FF33333] +c58 = <2 x float> [0x40066666, 0x40D9999A] +c61 = <2 x float> [0x41000000, 0x41000000] +c67 = <4 x float> [poison, poison, 0x0, 0x3F800000] +c74 = <2 x float> [0xBE19999A, 0xBF266666] +c75 = <2 x float> [0xBE19999A, 0x4009999A] +c76 = <2 x float> [0x4029999A, 0x4009999A] +c78 = <2 x float> [0x40000000, 0x40000000] +c80 = <2 x i32> [0, 1] +c81 = <2 x i32> [1, 1] + +define %t5 @f0 "qh_cells" memory(NoModRef, NoModRef, NoModRef) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" { +bb0: + %i0 = alloca %t29, i32 1, align 8 + %i1 = udiv i32 %a0, i32 3 + %i2 = urem i32 %a0, i32 3 + %i3 = bitcast %i0 to ptr addrspace(0) + %i4 = getelementptr inbounds %t29, %i0, i64 0, i64 0 + store <2 x float> c54, %i4, align 8 + %i6 = getelementptr inbounds %t29, %i0, i64 0, i64 1 + store <2 x float> c56, %i6, align 8 + %i8 = getelementptr inbounds %t29, %i0, i64 0, i64 2 + store <2 x float> c58, %i8, align 8 + %i10 = and i32 %i1, i32 7 + %i11 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i10) + %i12 = insertelement <2 x float> undef, %i11, i64 0 + %i13 = udiv i32 %a0, i32 24 + %i14 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i13) + %i15 = insertelement %i12, %i14, i64 1 + %i16 = fmul reassoc nnan ninf nsz arcp contract afn <2 x float> %i15, <2 x float> c61 + %i17 = zext %i2 to i64 + %i18 = getelementptr inbounds %t29, %i0, i64 0, %i17 + %i19 = load <2 x float>, %i18, align 8 + %i20 = fadd reassoc nnan ninf nsz arcp contract afn <2 x float> %i16, %i19 + %i21 = extractelement %i20, i64 0 + %i22 = fmul reassoc nnan ninf nsz arcp contract afn float %i21, float 0x3D000000 + %i23 = fadd reassoc nnan ninf nsz arcp contract afn float %i22, float 0xBF800000 + %i24 = extractelement %i20, i64 1 + %i25 = fmul reassoc nnan ninf nsz arcp contract afn float %i24, float 0x3D000000 + %i26 = fsub reassoc nnan ninf nsz arcp contract afn float float 0x3F800000, %i25 + %i27 = insertelement <4 x float> c67, %i23, i64 0 + %i28 = insertelement %i27, %i26, i64 1 + %i29 = insertvalue %t3 undef %i28, 0 + ret %i29 +} + +declare %t6 @f1 "air.convert.f.f32.u.i32" memory(NoModRef, NoModRef, NoModRef) + +define %t5 @f2 "qh_one" memory(NoModRef, NoModRef, NoModRef) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" { +bb0: + %i0 = alloca %t29, i32 1, align 8 + %i1 = udiv i32 %a0, i32 3 + %i2 = bitcast %i0 to ptr addrspace(0) + %i3 = getelementptr inbounds %t29, %i0, i64 0, i64 0 + store <2 x float> c74, %i3, align 8 + %i5 = getelementptr inbounds %t29, %i0, i64 0, i64 1 + store <2 x float> c75, %i5, align 8 + %i7 = getelementptr inbounds %t29, %i0, i64 0, i64 2 + store <2 x float> c76, %i7, align 8 + %i9 = urem i32 %a0, i32 3 + %i10 = zext %i9 to i64 + %i11 = getelementptr inbounds %t29, %i0, i64 0, %i10 + %i12 = load <2 x float>, %i11, align 8 + %i13 = and i32 %i1, i32 1 + %i14 = icmp eq %i13, i32 0 + %i15 = extractelement %i12, i64 0 + %i16 = fsub reassoc nnan ninf nsz arcp contract afn float float 0x40000000, %i15 + %i17 = insertelement %i12, %i16, i64 0 + %i18 = select <2 x float> %i14, %i17, %i12 + %i19 = icmp ult %a0, i32 6 + %i20 = extractelement %i18, i64 1 + %i21 = fsub reassoc nnan ninf nsz arcp contract afn float float 0x40000000, %i20 + %i22 = insertelement %i18, %i21, i64 1 + %i23 = select <2 x float> %i19, %i18, %i22 + %i24 = fadd reassoc nnan ninf nsz arcp contract afn <2 x float> %i23, <2 x float> c78 + %i25 = extractelement %i24, i64 0 + %i26 = fmul reassoc nnan ninf nsz arcp contract afn float %i25, float 0x3D000000 + %i27 = fadd reassoc nnan ninf nsz arcp contract afn float %i26, float 0xBF800000 + %i28 = extractelement %i24, i64 1 + %i29 = fmul reassoc nnan ninf nsz arcp contract afn float %i28, float 0x3D000000 + %i30 = fsub reassoc nnan ninf nsz arcp contract afn float float 0x3F800000, %i29 + %i31 = insertelement <4 x float> c67, %i27, i64 0 + %i32 = insertelement %i31, %i30, i64 1 + %i33 = insertvalue %t3 undef %i32, 0 + ret %i33 +} + +define %t9 @f3 "qh_any" convergent "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a2( Ref nocapture "air-buffer-no-alias"="" ) { +bb0: + %i0 = shufflevector <2 x float> %a0, <4 x float> poison, <0, 1> + %i1 = tail call <2 x i32> @f4 [air Convert(Convert { dst: NumTy { elem: I32, lanes: 2 }, dst_kind: Unsigned, src: NumTy { elem: F32, lanes: 2 }, src_kind: Float, src_fp8: None, rounding: None, saturate: false })](%i0) + %i2 = tail call i1 @f14 [air Fragment(IsHelperThread)]() convergent + %i3 = tail call i1 @f13 [air Group(Group { scope: Quad, op: Any, ty: None, sign: None })](%i2) convergent + %i4 = tail call reassoc nnan ninf nsz arcp contract afn float @f5 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I1, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i3) + %i5 = lshr <2 x i32> %i1, <2 x i32> c81 + %i6 = extractelement %i5, i64 0 + %i7 = mul i32 %i6, i32 2654435761 + %i8 = extractelement %i5, i64 1 + %i9 = mul i32 %i8, i32 2246822519 + %i10 = xor i32 %i7, %i9 + %i11 = lshr i32 %i10, i32 15 + %i12 = xor i32 %i11, %i10 + %i13 = mul i32 %i12, i32 739982445 + %i14 = lshr i32 %i13, i32 12 + %i15 = xor i32 %i14, %i13 + %i16 = and i32 %i15, i32 255 + %i17 = zext %i16 to i64 + %i18 = getelementptr inbounds i32, %a2, %i17 + %i19 = load i32, %i18, align 4 + %i20 = and i32 %i19, i32 255 + %i21 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i20) + %i22 = lshr i32 %i15, i32 8 + %i23 = and i32 %i22, i32 255 + %i24 = zext %i23 to i64 + %i25 = getelementptr inbounds i32, %a2, %i24 + %i26 = load i32, %i25, align 4 + %i27 = and i32 %i26, i32 7 + %i28 = add nuw nsw i32 %i27, i32 2 + %i29 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i28) + %i30 = lshr i32 %i15, i32 16 + %i31 = and i32 %i30, i32 255 + %i32 = zext %i31 to i64 + %i33 = getelementptr inbounds i32, %a2, %i32 + %i34 = load i32, %i33, align 4 + %i35 = and i32 %i34, i32 7 + %i36 = add nuw nsw i32 %i35, i32 2 + %i37 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i36) + %i38 = extractelement %i1, i64 0 + %i39 = and i32 %i38, i32 1 + %i40 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i39) + %i41 = fmul reassoc nnan ninf nsz arcp contract afn float %i40, %i29 + %i42 = extractelement %i1, i64 1 + %i43 = and i32 %i42, i32 1 + %i44 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i43) + %i45 = fmul reassoc nnan ninf nsz arcp contract afn float %i44, %i37 + %i46 = fadd reassoc nnan ninf nsz arcp contract afn float %i21, %i4 + %i47 = fadd reassoc nnan ninf nsz arcp contract afn float %i46, %i41 + %i48 = fadd reassoc nnan ninf nsz arcp contract afn float %i47, %i45 + %i49 = insertelement <4 x float> undef, %i4, i64 0 + %i50 = tail call reassoc nnan ninf nsz arcp contract afn float @f16 [air Derivative(Derivative { op: Dfdx, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i48) convergent + %i51 = insertelement %i49, %i50, i64 1 + %i52 = tail call reassoc nnan ninf nsz arcp contract afn float @f17 [air Derivative(Derivative { op: Dfdy, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i48) convergent + %i53 = insertelement %i51, %i52, i64 2 + %i54 = tail call reassoc nnan ninf nsz arcp contract afn float @f15 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I16, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%a1) + %i55 = insertelement %i53, %i54, i64 3 + ret %i55 +} + +declare %t12 @f4 "air.convert.u.v2i32.f.v2f32" memory(NoModRef, NoModRef, NoModRef) + +declare %t14 @f5 "air.convert.f.f32.u.i1" memory(NoModRef, NoModRef, NoModRef) + +define %t9 @f6 "qh_all" convergent "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a2( Ref nocapture "air-buffer-no-alias"="" ) { +bb0: + %i0 = shufflevector <2 x float> %a0, <4 x float> poison, <0, 1> + %i1 = tail call <2 x i32> @f4 [air Convert(Convert { dst: NumTy { elem: I32, lanes: 2 }, dst_kind: Unsigned, src: NumTy { elem: F32, lanes: 2 }, src_kind: Float, src_fp8: None, rounding: None, saturate: false })](%i0) + %i2 = tail call i1 @f14 [air Fragment(IsHelperThread)]() convergent + %i3 = xor i1 %i2, i1 1 + %i4 = tail call i1 @f18 [air Group(Group { scope: Quad, op: All, ty: None, sign: None })](%i3) convergent + %i5 = tail call reassoc nnan ninf nsz arcp contract afn float @f5 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I1, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i4) + %i6 = lshr <2 x i32> %i1, <2 x i32> c81 + %i7 = extractelement %i6, i64 0 + %i8 = mul i32 %i7, i32 2654435761 + %i9 = extractelement %i6, i64 1 + %i10 = mul i32 %i9, i32 2246822519 + %i11 = xor i32 %i8, %i10 + %i12 = lshr i32 %i11, i32 15 + %i13 = xor i32 %i12, %i11 + %i14 = mul i32 %i13, i32 739982445 + %i15 = lshr i32 %i14, i32 12 + %i16 = xor i32 %i15, %i14 + %i17 = and i32 %i16, i32 255 + %i18 = zext %i17 to i64 + %i19 = getelementptr inbounds i32, %a2, %i18 + %i20 = load i32, %i19, align 4 + %i21 = and i32 %i20, i32 255 + %i22 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i21) + %i23 = lshr i32 %i16, i32 8 + %i24 = and i32 %i23, i32 255 + %i25 = zext %i24 to i64 + %i26 = getelementptr inbounds i32, %a2, %i25 + %i27 = load i32, %i26, align 4 + %i28 = and i32 %i27, i32 7 + %i29 = add nuw nsw i32 %i28, i32 2 + %i30 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i29) + %i31 = lshr i32 %i16, i32 16 + %i32 = and i32 %i31, i32 255 + %i33 = zext %i32 to i64 + %i34 = getelementptr inbounds i32, %a2, %i33 + %i35 = load i32, %i34, align 4 + %i36 = and i32 %i35, i32 7 + %i37 = add nuw nsw i32 %i36, i32 2 + %i38 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i37) + %i39 = extractelement %i1, i64 0 + %i40 = and i32 %i39, i32 1 + %i41 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i40) + %i42 = fmul reassoc nnan ninf nsz arcp contract afn float %i41, %i30 + %i43 = extractelement %i1, i64 1 + %i44 = and i32 %i43, i32 1 + %i45 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i44) + %i46 = fmul reassoc nnan ninf nsz arcp contract afn float %i45, %i38 + %i47 = fadd reassoc nnan ninf nsz arcp contract afn float %i22, %i5 + %i48 = fadd reassoc nnan ninf nsz arcp contract afn float %i47, %i42 + %i49 = fadd reassoc nnan ninf nsz arcp contract afn float %i48, %i46 + %i50 = insertelement <4 x float> undef, %i5, i64 0 + %i51 = tail call reassoc nnan ninf nsz arcp contract afn float @f16 [air Derivative(Derivative { op: Dfdx, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i49) convergent + %i52 = insertelement %i50, %i51, i64 1 + %i53 = tail call reassoc nnan ninf nsz arcp contract afn float @f17 [air Derivative(Derivative { op: Dfdy, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i49) convergent + %i54 = insertelement %i52, %i53, i64 2 + %i55 = tail call reassoc nnan ninf nsz arcp contract afn float @f15 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I16, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%a1) + %i56 = insertelement %i54, %i55, i64 3 + ret %i56 +} + +define %t9 @f7 "qh_ballot" convergent "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a2( Ref nocapture "air-buffer-no-alias"="" ) { +bb0: + %i0 = shufflevector <2 x float> %a0, <4 x float> poison, <0, 1> + %i1 = tail call <2 x i32> @f4 [air Convert(Convert { dst: NumTy { elem: I32, lanes: 2 }, dst_kind: Unsigned, src: NumTy { elem: F32, lanes: 2 }, src_kind: Float, src_fp8: None, rounding: None, saturate: false })](%i0) + %i2 = tail call i1 @f14 [air Fragment(IsHelperThread)]() convergent + %i3 = tail call i16 @f19 [air Group(Group { scope: Quad, op: Ballot, ty: None, sign: None })](%i2) convergent + %i4 = and i16 %i3, i16 15 + %i5 = zext %i4 to i32 + %i6 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i5) + %i7 = lshr <2 x i32> %i1, <2 x i32> c81 + %i8 = extractelement %i7, i64 0 + %i9 = mul i32 %i8, i32 2654435761 + %i10 = extractelement %i7, i64 1 + %i11 = mul i32 %i10, i32 2246822519 + %i12 = xor i32 %i9, %i11 + %i13 = lshr i32 %i12, i32 15 + %i14 = xor i32 %i13, %i12 + %i15 = mul i32 %i14, i32 739982445 + %i16 = lshr i32 %i15, i32 12 + %i17 = xor i32 %i16, %i15 + %i18 = and i32 %i17, i32 255 + %i19 = zext %i18 to i64 + %i20 = getelementptr inbounds i32, %a2, %i19 + %i21 = load i32, %i20, align 4 + %i22 = and i32 %i21, i32 255 + %i23 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i22) + %i24 = lshr i32 %i17, i32 8 + %i25 = and i32 %i24, i32 255 + %i26 = zext %i25 to i64 + %i27 = getelementptr inbounds i32, %a2, %i26 + %i28 = load i32, %i27, align 4 + %i29 = and i32 %i28, i32 7 + %i30 = add nuw nsw i32 %i29, i32 2 + %i31 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i30) + %i32 = lshr i32 %i17, i32 16 + %i33 = and i32 %i32, i32 255 + %i34 = zext %i33 to i64 + %i35 = getelementptr inbounds i32, %a2, %i34 + %i36 = load i32, %i35, align 4 + %i37 = and i32 %i36, i32 7 + %i38 = add nuw nsw i32 %i37, i32 2 + %i39 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i38) + %i40 = extractelement %i1, i64 0 + %i41 = and i32 %i40, i32 1 + %i42 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i41) + %i43 = fmul reassoc nnan ninf nsz arcp contract afn float %i42, %i31 + %i44 = extractelement %i1, i64 1 + %i45 = and i32 %i44, i32 1 + %i46 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i45) + %i47 = fmul reassoc nnan ninf nsz arcp contract afn float %i46, %i39 + %i48 = fadd reassoc nnan ninf nsz arcp contract afn float %i23, %i6 + %i49 = fadd reassoc nnan ninf nsz arcp contract afn float %i48, %i43 + %i50 = fadd reassoc nnan ninf nsz arcp contract afn float %i49, %i47 + %i51 = insertelement <4 x float> undef, %i6, i64 0 + %i52 = tail call reassoc nnan ninf nsz arcp contract afn float @f16 [air Derivative(Derivative { op: Dfdx, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i50) convergent + %i53 = insertelement %i51, %i52, i64 1 + %i54 = tail call reassoc nnan ninf nsz arcp contract afn float @f17 [air Derivative(Derivative { op: Dfdy, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i50) convergent + %i55 = insertelement %i53, %i54, i64 2 + %i56 = tail call reassoc nnan ninf nsz arcp contract afn float @f15 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I16, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%a1) + %i57 = insertelement %i55, %i56, i64 3 + ret %i57 +} + +define %t9 @f8 "qh_is_first" convergent "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a2( Ref nocapture "air-buffer-no-alias"="" ) { +bb0: + %i0 = shufflevector <2 x float> %a0, <4 x float> poison, <0, 1> + %i1 = tail call <2 x i32> @f4 [air Convert(Convert { dst: NumTy { elem: I32, lanes: 2 }, dst_kind: Unsigned, src: NumTy { elem: F32, lanes: 2 }, src_kind: Float, src_fp8: None, rounding: None, saturate: false })](%i0) + %i2 = tail call i1 @f20 [air Group(Group { scope: Quad, op: IsFirst, ty: None, sign: None })]() convergent + %i3 = tail call reassoc nnan ninf nsz arcp contract afn float @f5 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I1, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i2) + %i4 = lshr <2 x i32> %i1, <2 x i32> c81 + %i5 = extractelement %i4, i64 0 + %i6 = mul i32 %i5, i32 2654435761 + %i7 = extractelement %i4, i64 1 + %i8 = mul i32 %i7, i32 2246822519 + %i9 = xor i32 %i6, %i8 + %i10 = lshr i32 %i9, i32 15 + %i11 = xor i32 %i10, %i9 + %i12 = mul i32 %i11, i32 739982445 + %i13 = lshr i32 %i12, i32 12 + %i14 = xor i32 %i13, %i12 + %i15 = and i32 %i14, i32 255 + %i16 = zext %i15 to i64 + %i17 = getelementptr inbounds i32, %a2, %i16 + %i18 = load i32, %i17, align 4 + %i19 = and i32 %i18, i32 255 + %i20 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i19) + %i21 = lshr i32 %i14, i32 8 + %i22 = and i32 %i21, i32 255 + %i23 = zext %i22 to i64 + %i24 = getelementptr inbounds i32, %a2, %i23 + %i25 = load i32, %i24, align 4 + %i26 = and i32 %i25, i32 7 + %i27 = add nuw nsw i32 %i26, i32 2 + %i28 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i27) + %i29 = lshr i32 %i14, i32 16 + %i30 = and i32 %i29, i32 255 + %i31 = zext %i30 to i64 + %i32 = getelementptr inbounds i32, %a2, %i31 + %i33 = load i32, %i32, align 4 + %i34 = and i32 %i33, i32 7 + %i35 = add nuw nsw i32 %i34, i32 2 + %i36 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i35) + %i37 = extractelement %i1, i64 0 + %i38 = and i32 %i37, i32 1 + %i39 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i38) + %i40 = fmul reassoc nnan ninf nsz arcp contract afn float %i39, %i28 + %i41 = extractelement %i1, i64 1 + %i42 = and i32 %i41, i32 1 + %i43 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i42) + %i44 = fmul reassoc nnan ninf nsz arcp contract afn float %i43, %i36 + %i45 = fadd reassoc nnan ninf nsz arcp contract afn float %i20, %i3 + %i46 = fadd reassoc nnan ninf nsz arcp contract afn float %i45, %i40 + %i47 = fadd reassoc nnan ninf nsz arcp contract afn float %i46, %i44 + %i48 = insertelement <4 x float> undef, %i3, i64 0 + %i49 = tail call reassoc nnan ninf nsz arcp contract afn float @f16 [air Derivative(Derivative { op: Dfdx, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i47) convergent + %i50 = insertelement %i48, %i49, i64 1 + %i51 = tail call reassoc nnan ninf nsz arcp contract afn float @f17 [air Derivative(Derivative { op: Dfdy, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i47) convergent + %i52 = insertelement %i50, %i51, i64 2 + %i53 = tail call reassoc nnan ninf nsz arcp contract afn float @f15 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I16, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%a1) + %i54 = insertelement %i52, %i53, i64 3 + ret %i54 +} + +define %t9 @f9 "qh_active" convergent "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a2( Ref nocapture "air-buffer-no-alias"="" ) { +bb0: + %i0 = shufflevector <2 x float> %a0, <4 x float> poison, <0, 1> + %i1 = tail call <2 x i32> @f4 [air Convert(Convert { dst: NumTy { elem: I32, lanes: 2 }, dst_kind: Unsigned, src: NumTy { elem: F32, lanes: 2 }, src_kind: Float, src_fp8: None, rounding: None, saturate: false })](%i0) + %i2 = tail call i16 @f21 [air Group(Group { scope: Quad, op: ActiveThreadsMask, ty: None, sign: None })]() convergent + %i3 = and i16 %i2, i16 15 + %i4 = zext %i3 to i32 + %i5 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i4) + %i6 = lshr <2 x i32> %i1, <2 x i32> c81 + %i7 = extractelement %i6, i64 0 + %i8 = mul i32 %i7, i32 2654435761 + %i9 = extractelement %i6, i64 1 + %i10 = mul i32 %i9, i32 2246822519 + %i11 = xor i32 %i8, %i10 + %i12 = lshr i32 %i11, i32 15 + %i13 = xor i32 %i12, %i11 + %i14 = mul i32 %i13, i32 739982445 + %i15 = lshr i32 %i14, i32 12 + %i16 = xor i32 %i15, %i14 + %i17 = and i32 %i16, i32 255 + %i18 = zext %i17 to i64 + %i19 = getelementptr inbounds i32, %a2, %i18 + %i20 = load i32, %i19, align 4 + %i21 = and i32 %i20, i32 255 + %i22 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i21) + %i23 = lshr i32 %i16, i32 8 + %i24 = and i32 %i23, i32 255 + %i25 = zext %i24 to i64 + %i26 = getelementptr inbounds i32, %a2, %i25 + %i27 = load i32, %i26, align 4 + %i28 = and i32 %i27, i32 7 + %i29 = add nuw nsw i32 %i28, i32 2 + %i30 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i29) + %i31 = lshr i32 %i16, i32 16 + %i32 = and i32 %i31, i32 255 + %i33 = zext %i32 to i64 + %i34 = getelementptr inbounds i32, %a2, %i33 + %i35 = load i32, %i34, align 4 + %i36 = and i32 %i35, i32 7 + %i37 = add nuw nsw i32 %i36, i32 2 + %i38 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i37) + %i39 = extractelement %i1, i64 0 + %i40 = and i32 %i39, i32 1 + %i41 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i40) + %i42 = fmul reassoc nnan ninf nsz arcp contract afn float %i41, %i30 + %i43 = extractelement %i1, i64 1 + %i44 = and i32 %i43, i32 1 + %i45 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i44) + %i46 = fmul reassoc nnan ninf nsz arcp contract afn float %i45, %i38 + %i47 = fadd reassoc nnan ninf nsz arcp contract afn float %i22, %i5 + %i48 = fadd reassoc nnan ninf nsz arcp contract afn float %i47, %i42 + %i49 = fadd reassoc nnan ninf nsz arcp contract afn float %i48, %i46 + %i50 = insertelement <4 x float> undef, %i5, i64 0 + %i51 = tail call reassoc nnan ninf nsz arcp contract afn float @f16 [air Derivative(Derivative { op: Dfdx, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i49) convergent + %i52 = insertelement %i50, %i51, i64 1 + %i53 = tail call reassoc nnan ninf nsz arcp contract afn float @f17 [air Derivative(Derivative { op: Dfdy, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i49) convergent + %i54 = insertelement %i52, %i53, i64 2 + %i55 = tail call reassoc nnan ninf nsz arcp contract afn float @f15 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I16, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%a1) + %i56 = insertelement %i54, %i55, i64 3 + ret %i56 +} + +define %t15 @f10 "qs_arith" convergent "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a1( Ref nocapture "air-buffer-no-alias"="" ) { +bb0: + %i0 = shufflevector <2 x float> %a0, <4 x float> poison, <0, 1> + %i1 = tail call <2 x i32> @f4 [air Convert(Convert { dst: NumTy { elem: I32, lanes: 2 }, dst_kind: Unsigned, src: NumTy { elem: F32, lanes: 2 }, src_kind: Float, src_fp8: None, rounding: None, saturate: false })](%i0) + %i2 = extractelement %i1, i64 0 + %i3 = mul i32 %i2, i32 2654435761 + %i4 = extractelement %i1, i64 1 + %i5 = mul i32 %i4, i32 2246822519 + %i6 = xor i32 %i3, %i5 + %i7 = lshr i32 %i6, i32 15 + %i8 = xor i32 %i7, %i6 + %i9 = mul i32 %i8, i32 739982445 + %i10 = lshr i32 %i9, i32 12 + %i11 = xor i32 %i10, %i9 + %i12 = and i32 %i11, i32 255 + %i13 = zext %i12 to i64 + %i14 = getelementptr inbounds i32, %a1, %i13 + %i15 = load i32, %i14, align 4 + %i16 = and i32 %i15, i32 255 + %i17 = tail call i32 @f28 [air Group(Group { scope: Simdgroup, op: Sum, ty: Some(NumTy { elem: I32, lanes: 1 }), sign: Some(Unsigned) })](%i16) convergent + %i18 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i17) + %i19 = insertelement <4 x float> undef, %i18, i64 0 + %i20 = tail call i32 @f29 [air Group(Group { scope: Simdgroup, op: Min, ty: Some(NumTy { elem: I32, lanes: 1 }), sign: Some(Unsigned) })](%i16) convergent + %i21 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i20) + %i22 = insertelement %i19, %i21, i64 1 + %i23 = tail call i32 @f30 [air Group(Group { scope: Simdgroup, op: Max, ty: Some(NumTy { elem: I32, lanes: 1 }), sign: Some(Unsigned) })](%i16) convergent + %i24 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i23) + %i25 = insertelement %i22, %i24, i64 2 + %i26 = lshr <2 x i32> %i1, <2 x i32> c81 + %i27 = extractelement %i26, i64 0 + %i28 = mul i32 %i27, i32 2654435761 + %i29 = extractelement %i26, i64 1 + %i30 = mul i32 %i29, i32 2246822519 + %i31 = xor i32 %i28, %i30 + %i32 = lshr i32 %i31, i32 15 + %i33 = xor i32 %i32, %i31 + %i34 = mul i32 %i33, i32 739982445 + %i35 = lshr i32 %i34, i32 12 + %i36 = xor i32 %i35, %i34 + %i37 = and i32 %i36, i32 255 + %i38 = zext %i37 to i64 + %i39 = getelementptr inbounds i32, %a1, %i38 + %i40 = load i32, %i39, align 4 + %i41 = and i32 %i40, i32 255 + %i42 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i41) + %i43 = lshr i32 %i36, i32 8 + %i44 = and i32 %i43, i32 255 + %i45 = zext %i44 to i64 + %i46 = getelementptr inbounds i32, %a1, %i45 + %i47 = load i32, %i46, align 4 + %i48 = and i32 %i47, i32 7 + %i49 = add nuw nsw i32 %i48, i32 2 + %i50 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i49) + %i51 = lshr i32 %i36, i32 16 + %i52 = and i32 %i51, i32 255 + %i53 = zext %i52 to i64 + %i54 = getelementptr inbounds i32, %a1, %i53 + %i55 = load i32, %i54, align 4 + %i56 = and i32 %i55, i32 7 + %i57 = add nuw nsw i32 %i56, i32 2 + %i58 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i57) + %i59 = and i32 %i2, i32 1 + %i60 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i59) + %i61 = fmul reassoc nnan ninf nsz arcp contract afn float %i60, %i50 + %i62 = and i32 %i4, i32 1 + %i63 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i62) + %i64 = fmul reassoc nnan ninf nsz arcp contract afn float %i63, %i58 + %i65 = fadd reassoc nnan ninf nsz arcp contract afn float %i21, %i18 + %i66 = fadd reassoc nnan ninf nsz arcp contract afn float %i65, %i24 + %i67 = fadd reassoc nnan ninf nsz arcp contract afn float %i66, %i42 + %i68 = fadd reassoc nnan ninf nsz arcp contract afn float %i67, %i61 + %i69 = fadd reassoc nnan ninf nsz arcp contract afn float %i68, %i64 + %i70 = tail call reassoc nnan ninf nsz arcp contract afn float @f16 [air Derivative(Derivative { op: Dfdx, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i69) convergent + %i71 = insertelement %i25, %i70, i64 3 + ret %i71 +} + +define %t15 @f11 "qs_bits" convergent "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a1( Ref nocapture "air-buffer-no-alias"="" ) { +bb0: + %i0 = shufflevector <2 x float> %a0, <4 x float> poison, <0, 1> + %i1 = tail call <2 x i32> @f4 [air Convert(Convert { dst: NumTy { elem: I32, lanes: 2 }, dst_kind: Unsigned, src: NumTy { elem: F32, lanes: 2 }, src_kind: Float, src_fp8: None, rounding: None, saturate: false })](%i0) + %i2 = extractelement %i1, i64 0 + %i3 = mul i32 %i2, i32 2654435761 + %i4 = extractelement %i1, i64 1 + %i5 = mul i32 %i4, i32 2246822519 + %i6 = xor i32 %i3, %i5 + %i7 = lshr i32 %i6, i32 15 + %i8 = xor i32 %i7, %i6 + %i9 = mul i32 %i8, i32 739982445 + %i10 = lshr i32 %i9, i32 12 + %i11 = xor i32 %i10, %i9 + %i12 = and i32 %i11, i32 255 + %i13 = zext %i12 to i64 + %i14 = getelementptr inbounds i32, %a1, %i13 + %i15 = load i32, %i14, align 4 + %i16 = and i32 %i15, i32 2047 + %i17 = tail call i32 @f31 [air Group(Group { scope: Simdgroup, op: And, ty: Some(NumTy { elem: I32, lanes: 1 }), sign: Some(Unsigned) })](%i16) convergent + %i18 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i17) + %i19 = insertelement <4 x float> undef, %i18, i64 0 + %i20 = tail call i32 @f32 [air Group(Group { scope: Simdgroup, op: Or, ty: Some(NumTy { elem: I32, lanes: 1 }), sign: Some(Unsigned) })](%i16) convergent + %i21 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i20) + %i22 = insertelement %i19, %i21, i64 1 + %i23 = tail call i32 @f33 [air Group(Group { scope: Simdgroup, op: Xor, ty: Some(NumTy { elem: I32, lanes: 1 }), sign: Some(Unsigned) })](%i16) convergent + %i24 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i23) + %i25 = insertelement %i22, %i24, i64 2 + %i26 = lshr <2 x i32> %i1, <2 x i32> c81 + %i27 = extractelement %i26, i64 0 + %i28 = mul i32 %i27, i32 2654435761 + %i29 = extractelement %i26, i64 1 + %i30 = mul i32 %i29, i32 2246822519 + %i31 = xor i32 %i28, %i30 + %i32 = lshr i32 %i31, i32 15 + %i33 = xor i32 %i32, %i31 + %i34 = mul i32 %i33, i32 739982445 + %i35 = lshr i32 %i34, i32 12 + %i36 = xor i32 %i35, %i34 + %i37 = and i32 %i36, i32 255 + %i38 = zext %i37 to i64 + %i39 = getelementptr inbounds i32, %a1, %i38 + %i40 = load i32, %i39, align 4 + %i41 = and i32 %i40, i32 255 + %i42 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i41) + %i43 = lshr i32 %i36, i32 8 + %i44 = and i32 %i43, i32 255 + %i45 = zext %i44 to i64 + %i46 = getelementptr inbounds i32, %a1, %i45 + %i47 = load i32, %i46, align 4 + %i48 = and i32 %i47, i32 7 + %i49 = add nuw nsw i32 %i48, i32 2 + %i50 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i49) + %i51 = lshr i32 %i36, i32 16 + %i52 = and i32 %i51, i32 255 + %i53 = zext %i52 to i64 + %i54 = getelementptr inbounds i32, %a1, %i53 + %i55 = load i32, %i54, align 4 + %i56 = and i32 %i55, i32 7 + %i57 = add nuw nsw i32 %i56, i32 2 + %i58 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i57) + %i59 = and i32 %i2, i32 1 + %i60 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i59) + %i61 = fmul reassoc nnan ninf nsz arcp contract afn float %i60, %i50 + %i62 = and i32 %i4, i32 1 + %i63 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i62) + %i64 = fmul reassoc nnan ninf nsz arcp contract afn float %i63, %i58 + %i65 = fadd reassoc nnan ninf nsz arcp contract afn float %i21, %i18 + %i66 = fadd reassoc nnan ninf nsz arcp contract afn float %i65, %i24 + %i67 = fadd reassoc nnan ninf nsz arcp contract afn float %i66, %i42 + %i68 = fadd reassoc nnan ninf nsz arcp contract afn float %i67, %i61 + %i69 = fadd reassoc nnan ninf nsz arcp contract afn float %i68, %i64 + %i70 = tail call reassoc nnan ninf nsz arcp contract afn float @f16 [air Derivative(Derivative { op: Dfdx, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i69) convergent + %i71 = insertelement %i25, %i70, i64 3 + ret %i71 +} + +define %t15 @f12 "qs_votes" convergent "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a1( Ref nocapture "air-buffer-no-alias"="" ) { +bb0: + %i0 = shufflevector <2 x float> %a0, <4 x float> poison, <0, 1> + %i1 = tail call <2 x i32> @f4 [air Convert(Convert { dst: NumTy { elem: I32, lanes: 2 }, dst_kind: Unsigned, src: NumTy { elem: F32, lanes: 2 }, src_kind: Float, src_fp8: None, rounding: None, saturate: false })](%i0) + %i2 = tail call i1 @f22 [air Fragment(IsHelperThread)]() convergent + %i3 = tail call i1 @f23 [air Group(Group { scope: Simdgroup, op: Any, ty: None, sign: None })](%i2) convergent + %i4 = zext %i3 to i32 + %i5 = xor i1 %i2, i1 1 + %i6 = tail call i1 @f24 [air Group(Group { scope: Simdgroup, op: All, ty: None, sign: None })](%i5) convergent + %i7 = select i32 %i6, i32 2, i32 0 + %i8 = or i32 %i7, %i4 + %i9 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i8) + %i10 = insertelement <4 x float> undef, %i9, i64 0 + %i11 = tail call i64 @f26 [air Group(Group { scope: Simdgroup, op: Ballot, ty: Some(NumTy { elem: I64, lanes: 1 }), sign: None })](%i2) convergent + %i12 = trunc %i11 to i32 + %i13 = tail call i32 @f25 [air Math(Math { f: Popcount, precision: Precise, ty: NumTy { elem: I32, lanes: 1 } })](%i12) + %i14 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i13) + %i15 = insertelement %i10, %i14, i64 1 + %i16 = tail call i64 @f27 [air Group(Group { scope: Simdgroup, op: ActiveThreadsMask, ty: Some(NumTy { elem: I64, lanes: 1 }), sign: None })]() convergent + %i17 = trunc %i16 to i32 + %i18 = tail call i32 @f25 [air Math(Math { f: Popcount, precision: Precise, ty: NumTy { elem: I32, lanes: 1 } })](%i17) + %i19 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i18) + %i20 = insertelement %i15, %i19, i64 2 + %i21 = lshr <2 x i32> %i1, <2 x i32> c81 + %i22 = extractelement %i21, i64 0 + %i23 = mul i32 %i22, i32 2654435761 + %i24 = extractelement %i21, i64 1 + %i25 = mul i32 %i24, i32 2246822519 + %i26 = xor i32 %i23, %i25 + %i27 = lshr i32 %i26, i32 15 + %i28 = xor i32 %i27, %i26 + %i29 = mul i32 %i28, i32 739982445 + %i30 = lshr i32 %i29, i32 12 + %i31 = xor i32 %i30, %i29 + %i32 = and i32 %i31, i32 255 + %i33 = zext %i32 to i64 + %i34 = getelementptr inbounds i32, %a1, %i33 + %i35 = load i32, %i34, align 4 + %i36 = and i32 %i35, i32 255 + %i37 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i36) + %i38 = lshr i32 %i31, i32 8 + %i39 = and i32 %i38, i32 255 + %i40 = zext %i39 to i64 + %i41 = getelementptr inbounds i32, %a1, %i40 + %i42 = load i32, %i41, align 4 + %i43 = and i32 %i42, i32 7 + %i44 = add nuw nsw i32 %i43, i32 2 + %i45 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i44) + %i46 = lshr i32 %i31, i32 16 + %i47 = and i32 %i46, i32 255 + %i48 = zext %i47 to i64 + %i49 = getelementptr inbounds i32, %a1, %i48 + %i50 = load i32, %i49, align 4 + %i51 = and i32 %i50, i32 7 + %i52 = add nuw nsw i32 %i51, i32 2 + %i53 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i52) + %i54 = extractelement %i1, i64 0 + %i55 = and i32 %i54, i32 1 + %i56 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i55) + %i57 = fmul reassoc nnan ninf nsz arcp contract afn float %i56, %i45 + %i58 = extractelement %i1, i64 1 + %i59 = and i32 %i58, i32 1 + %i60 = tail call reassoc nnan ninf nsz arcp contract afn float @f1 [air Convert(Convert { dst: NumTy { elem: F32, lanes: 1 }, dst_kind: Float, src: NumTy { elem: I32, lanes: 1 }, src_kind: Unsigned, src_fp8: None, rounding: None, saturate: false })](%i59) + %i61 = fmul reassoc nnan ninf nsz arcp contract afn float %i60, %i53 + %i62 = fadd reassoc nnan ninf nsz arcp contract afn float %i14, %i9 + %i63 = fadd reassoc nnan ninf nsz arcp contract afn float %i62, %i19 + %i64 = fadd reassoc nnan ninf nsz arcp contract afn float %i63, %i37 + %i65 = fadd reassoc nnan ninf nsz arcp contract afn float %i64, %i57 + %i66 = fadd reassoc nnan ninf nsz arcp contract afn float %i65, %i61 + %i67 = tail call reassoc nnan ninf nsz arcp contract afn float @f16 [air Derivative(Derivative { op: Dfdx, fast: false, ty: NumTy { elem: F32, lanes: 1 } })](%i66) convergent + %i68 = insertelement %i20, %i67, i64 3 + ret %i68 +} + +declare %t16 @f13 "air.quad_any" convergent + +declare %t17 @f14 "air.quad_is_helper_thread" convergent + +declare %t18 @f15 "air.convert.f.f32.u.i16" memory(NoModRef, NoModRef, NoModRef) + +declare %t19 @f16 "air.dfdx.f32" convergent + +declare %t19 @f17 "air.dfdy.f32" convergent + +declare %t16 @f18 "air.quad_all" convergent + +declare %t20 @f19 "air.quad_ballot" convergent + +declare %t17 @f20 "air.quad_is_first" convergent + +declare %t21 @f21 "air.quad_active_threads_mask" convergent + +declare %t17 @f22 "air.simd_is_helper_thread" convergent + +declare %t16 @f23 "air.simd_any" convergent + +declare %t16 @f24 "air.simd_all" convergent + +declare %t22 @f25 "air.popcount.i32" memory(NoModRef, NoModRef, NoModRef) + +declare %t24 @f26 "air.simd_ballot.i64" convergent + +declare %t25 @f27 "air.simd_active_threads_mask.i64" convergent + +declare %t22 @f28 "air.simd_sum.u.i32" convergent + +declare %t22 @f29 "air.simd_min.u.i32" convergent + +declare %t22 @f30 "air.simd_max.u.i32" convergent + +declare %t22 @f31 "air.simd_and.u.i32" convergent + +declare %t22 @f32 "air.simd_or.u.i32" convergent + +declare %t22 @f33 "air.simd_xor.u.i32" convergent +!md0 = !"SDK Version" +!md1 = !"wchar_size" +!md2 = !"frame-pointer" +!md3 = !"air.max_device_buffers" +!md4 = !"air.max_constant_buffers" +!md5 = !"air.max_threadgroup_buffers" +!md6 = !"air.max_textures" +!md7 = !"air.max_read_write_textures" +!md8 = !"air.max_samplers" +!md9 = !"air.position" +!md10 = !"air.arg_type_name" +!md11 = !"float4" +!md12 = !"air.arg_name" +!md13 = !"position" +!md14 = !"air.vertex_id" +!md15 = !"uint" +!md16 = !"id" +!md17 = !"air.render_target" +!md18 = !"air.center" +!md19 = !"air.no_perspective" +!md20 = !"air.thread_index_in_quadgroup" +!md21 = !"ushort" +!md22 = !"lane" +!md23 = !"air.buffer" +!md24 = !"air.location_index" +!md25 = !"air.read" +!md26 = !"air.address_space" +!md27 = !"air.arg_type_size" +!md28 = !"air.arg_type_align_size" +!md29 = !"data" +!md30 = !"air.compile.denorms_disable" +!md31 = !"air.compile.fast_math_enable" +!md32 = !"air.compile.framebuffer_fetch_enable" +!md33 = !"Apple metal version 32023.922 (metalfe-32023.922.4)" +!md34 = !"Metal" +!md35 = !"omnipotent char" +!md36 = !"Simple C++ TBAA" +!md37 = !"int" +!md38 = !"air-alias-scope-arg(2)" +!md39 = !"air-alias-scope-arg(1)" +!md40 = i32 2 +!md41 = %t28 c36 +!md42 = i32 1 +!md43 = i32 4 +!md44 = i32 7 +!md45 = i32 31 +!md46 = i32 128 +!md47 = i32 8 +!md48 = i32 16 +!md49 = ptr addrspace(0) @f0 +!md50 = i32 0 +!md51 = ptr addrspace(0) @f2 +!md52 = ptr addrspace(0) @f3 +!md53 = ptr addrspace(0) @f6 +!md54 = ptr addrspace(0) @f7 +!md55 = ptr addrspace(0) @f8 +!md56 = ptr addrspace(0) @f9 +!md57 = ptr addrspace(0) @f10 +!md58 = ptr addrspace(0) @f11 +!md59 = ptr addrspace(0) @f12 +!md60 = i64 0 +!md61 = !{!md40, !md0, !md41} +!md62 = !{!md42, !md1, !md43} +!md63 = !{!md44, !md2, !md40} +!md64 = !{!md44, !md3, !md45} +!md65 = !{!md44, !md4, !md45} +!md66 = !{!md44, !md5, !md45} +!md67 = !{!md44, !md6, !md46} +!md68 = !{!md44, !md7, !md47} +!md69 = !{!md44, !md8, !md48} +!md70 = !{!md9, !md10, !md11, !md12, !md13} +!md71 = !{!md70} +!md72 = !{!md50, !md14, !md10, !md15, !md12, !md16} +!md73 = !{!md72} +!md74 = !{!md49, !md71, !md73} +!md75 = !{!md51, !md71, !md73} +!md76 = !{!md17, !md50, !md50, !md10, !md11} +!md77 = !{!md76} +!md78 = !{!md50, !md9, !md18, !md19, !md10, !md11, !md12, !md13} +!md79 = !{!md42, !md20, !md10, !md21, !md12, !md22} +!md80 = !{!md40, !md23, !md24, !md50, !md42, !md25, !md26, !md42, !md27, !md43, !md28, !md43, !md10, !md15, !md12, !md29} +!md81 = !{!md78, !md79, !md80} +!md82 = !{!md52, !md77, !md81} +!md83 = !{!md53, !md77, !md81} +!md84 = !{!md54, !md77, !md81} +!md85 = !{!md55, !md77, !md81} +!md86 = !{!md56, !md77, !md81} +!md87 = !{!md42, !md23, !md24, !md50, !md42, !md25, !md26, !md42, !md27, !md43, !md28, !md43, !md10, !md15, !md12, !md29} +!md88 = !{!md78, !md87} +!md89 = !{!md57, !md77, !md88} +!md90 = !{!md58, !md77, !md88} +!md91 = !{!md59, !md77, !md88} +!md92 = !{!md30} +!md93 = !{!md31} +!md94 = !{!md32} +!md95 = !{!md33} +!md96 = !{!md40, !md47, !md50} +!md97 = !{!md34, !md43, !md50, !md50} +!md98 = !{!md36} +!md99 = !{!md35, !md98, !md60} +!md100 = !{!md99, !md99, !md60} +!md101 = !{!md37, !md99, !md60} +!md102 = !{!md101, !md101, !md60} +!"llvm.module.flags" = !{!md61, !md62, !md63, !md64, !md65, !md66, !md67, !md68, !md69} +!"air.vertex" = !{!md74, !md75} +!"air.fragment" = !{!md82, !md83, !md84, !md85, !md86, !md89, !md90, !md91} +!"air.compile_options" = !{!md92, !md93, !md94} +!"llvm.ident" = !{!md95} +!"air.version" = !{!md96} +!"air.language_version" = !{!md97}