The `dx.dot2`, `dot3`, and `dot4` intrinsics exist purely to lower `dx.fdot`, and they map exactly to the DXIL ops of the same name. Using vectors for their arguments adds unnecessary complexity and causes us to have vector operations that are not trivial to lower post-scalarizer. Similarly, the `dx.dot2add` intrinsic is overly generic for something that only needs to lower to a single `dot2AddHalf` DXIL op. Update its signature to match the operation it lowers to. Fixes #134569.
30 lines
1.6 KiB
C
30 lines
1.6 KiB
C
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
|
|
|
|
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library %s -emit-llvm -o - | FileCheck %s
|
|
|
|
typedef _Float16 half;
|
|
typedef half half2 __attribute__((ext_vector_type(2)));
|
|
|
|
// CHECK-LABEL: define float @test_dot2add(
|
|
// CHECK-SAME: <2 x half> noundef [[X:%.*]], <2 x half> noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR0:[0-9]+]] {
|
|
// CHECK-NEXT: [[ENTRY:.*:]]
|
|
// CHECK-NEXT: [[X_ADDR:%.*]] = alloca <2 x half>, align 4
|
|
// CHECK-NEXT: [[Y_ADDR:%.*]] = alloca <2 x half>, align 4
|
|
// CHECK-NEXT: [[Z_ADDR:%.*]] = alloca float, align 4
|
|
// CHECK-NEXT: store <2 x half> [[X]], ptr [[X_ADDR]], align 4
|
|
// CHECK-NEXT: store <2 x half> [[Y]], ptr [[Y_ADDR]], align 4
|
|
// CHECK-NEXT: store float [[Z]], ptr [[Z_ADDR]], align 4
|
|
// CHECK-NEXT: [[TMP0:%.*]] = load <2 x half>, ptr [[X_ADDR]], align 4
|
|
// CHECK-NEXT: [[TMP1:%.*]] = load <2 x half>, ptr [[Y_ADDR]], align 4
|
|
// CHECK-NEXT: [[TMP2:%.*]] = load float, ptr [[Z_ADDR]], align 4
|
|
// CHECK-NEXT: [[TMP3:%.*]] = extractelement <2 x half> [[TMP0]], i32 0
|
|
// CHECK-NEXT: [[TMP4:%.*]] = extractelement <2 x half> [[TMP0]], i32 1
|
|
// CHECK-NEXT: [[TMP5:%.*]] = extractelement <2 x half> [[TMP1]], i32 0
|
|
// CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x half> [[TMP1]], i32 1
|
|
// CHECK-NEXT: [[DX_DOT2ADD:%.*]] = call float @llvm.dx.dot2add(float [[TMP2]], half [[TMP3]], half [[TMP4]], half [[TMP5]], half [[TMP6]])
|
|
// CHECK-NEXT: ret float [[DX_DOT2ADD]]
|
|
//
|
|
float test_dot2add(half2 X, half2 Y, float Z) {
|
|
return __builtin_dx_dot2add(X, Y, Z);
|
|
}
|