Skip to content

Commit 47df485

Browse files
committed
Add support to specify overload types specific to Shader Model
for TableGen records of DXIL Opeartions.
1 parent b699f5f commit 47df485

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+298
-183
lines changed

llvm/lib/Target/DirectX/DXIL.td

Lines changed: 127 additions & 113 deletions
Large diffs are not rendered by default.

llvm/lib/Target/DirectX/DXILOpBuilder.cpp

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/IR/Module.h"
1616
#include "llvm/Support/DXILABI.h"
1717
#include "llvm/Support/ErrorHandling.h"
18+
#include <string>
1819

1920
using namespace llvm;
2021
using namespace llvm::dxil;
@@ -123,6 +124,11 @@ static std::string getTypeName(OverloadKind Kind, Type *Ty) {
123124
}
124125
}
125126

127+
struct OpSMOverloadProp {
128+
uint16_t ShaderModelVer;
129+
uint16_t ValidTys;
130+
};
131+
126132
// Static properties.
127133
struct OpCodeProperty {
128134
dxil::OpCode OpCode;
@@ -131,7 +137,7 @@ struct OpCodeProperty {
131137
dxil::OpCodeClass OpCodeClass;
132138
// Offset in DXILOpCodeClassNameTable.
133139
unsigned OpCodeClassNameOffset;
134-
uint16_t OverloadTys;
140+
std::vector<OpSMOverloadProp> OverloadProp;
135141
llvm::Attribute::AttrKind FuncAttr;
136142
int OverloadParamIndex; // parameter index which control the overload.
137143
// When < 0, should be only 1 overload type.
@@ -249,16 +255,38 @@ static FunctionType *getDXILOpFunctionType(const OpCodeProperty *Prop,
249255
ArgTys[0], ArrayRef<Type *>(&ArgTys[1], ArgTys.size() - 1), false);
250256
}
251257

258+
static uint16_t getValidOverloadMask(const OpCodeProperty *Prop,
259+
uint32_t SMVer) {
260+
uint16_t ValidTyMask = 0;
261+
// std::vector Prop->OverloadProp is in ascending order of SM Version
262+
// Overloads of highest SM version that is not greater than SMVer
263+
// are the ones that are valid for SMVer.
264+
for (auto OL : Prop->OverloadProp) {
265+
if (OL.ShaderModelVer <= SMVer) {
266+
ValidTyMask = OL.ValidTys;
267+
} else {
268+
break;
269+
}
270+
}
271+
return ValidTyMask;
272+
}
273+
252274
namespace llvm {
253275
namespace dxil {
254276

255-
CallInst *DXILOpBuilder::createDXILOpCall(dxil::OpCode OpCode, Type *ReturnTy,
256-
Type *OverloadTy,
277+
CallInst *DXILOpBuilder::createDXILOpCall(dxil::OpCode OpCode, uint32_t SMVer,
278+
Type *ReturnTy, Type *OverloadTy,
257279
SmallVector<Value *> Args) {
258280
const OpCodeProperty *Prop = getOpCodeProperty(OpCode);
281+
uint16_t ValidTyMask = getValidOverloadMask(Prop, SMVer);
259282

283+
if (ValidTyMask == 0) {
284+
report_fatal_error(StringRef(std::to_string(SMVer).append(
285+
": Unhandled Shader Model Version")),
286+
/*gen_crash_diag*/ false);
287+
}
260288
OverloadKind Kind = getOverloadKind(OverloadTy);
261-
if ((Prop->OverloadTys & (uint16_t)Kind) == 0) {
289+
if ((ValidTyMask & (uint16_t)Kind) == 0) {
262290
report_fatal_error("Invalid Overload Type", /* gen_crash_diag=*/false);
263291
}
264292

@@ -276,14 +304,22 @@ CallInst *DXILOpBuilder::createDXILOpCall(dxil::OpCode OpCode, Type *ReturnTy,
276304
return B.CreateCall(DXILFn, Args);
277305
}
278306

279-
Type *DXILOpBuilder::getOverloadTy(dxil::OpCode OpCode, FunctionType *FT) {
307+
Type *DXILOpBuilder::getOverloadTy(dxil::OpCode OpCode, uint32_t SMVer,
308+
FunctionType *FT) {
280309

281310
const OpCodeProperty *Prop = getOpCodeProperty(OpCode);
282311
// If DXIL Op has no overload parameter, just return the
283312
// precise return type specified.
284313
if (Prop->OverloadParamIndex < 0) {
285314
auto &Ctx = FT->getContext();
286-
switch (Prop->OverloadTys) {
315+
uint16_t ValidTyMask = getValidOverloadMask(Prop, SMVer);
316+
if (ValidTyMask == 0) {
317+
report_fatal_error(StringRef(std::to_string(SMVer).append(
318+
": Unhandled Shader Model Version")),
319+
/*gen_crash_diag*/ false);
320+
}
321+
322+
switch (ValidTyMask) {
287323
case OverloadKind::VOID:
288324
return Type::getVoidTy(Ctx);
289325
case OverloadKind::HALF:

llvm/lib/Target/DirectX/DXILOpBuilder.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "DXILConstants.h"
1616
#include "llvm/ADT/SmallVector.h"
17+
#include <cstdint>
1718

1819
namespace llvm {
1920
class Module;
@@ -30,13 +31,17 @@ class DXILOpBuilder {
3031
public:
3132
DXILOpBuilder(Module &M, IRBuilderBase &B) : M(M), B(B) {}
3233
/// Create an instruction that calls DXIL Op with return type, specified
33-
/// opcode, and call arguments. \param OpCode Opcode of the DXIL Op call
34-
/// constructed \param ReturnTy Return type of the DXIL Op call constructed
34+
/// opcode, and call arguments.
35+
///
36+
/// \param OpCode Opcode of the DXIL Op call constructed
37+
/// \param SMVer Shader Model Version of DXIL Op call to construct
38+
/// \param ReturnTy Return type of the DXIL Op call constructed
3539
/// \param OverloadTy Overload type of the DXIL Op call constructed
3640
/// \return DXIL Op call constructed
37-
CallInst *createDXILOpCall(dxil::OpCode OpCode, Type *ReturnTy,
38-
Type *OverloadTy, SmallVector<Value *> Args);
39-
Type *getOverloadTy(dxil::OpCode OpCode, FunctionType *FT);
41+
CallInst *createDXILOpCall(dxil::OpCode OpCode, uint32_t SMVer,
42+
Type *ReturnTy, Type *OverloadTy,
43+
SmallVector<Value *> Args);
44+
Type *getOverloadTy(dxil::OpCode OpCode, uint32_t SMVer, FunctionType *FT);
4045
static const char *getOpCodeName(dxil::OpCode DXILOp);
4146

4247
private:

llvm/lib/Target/DirectX/DXILOpLowering.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/IR/IntrinsicsDirectX.h"
2323
#include "llvm/IR/Module.h"
2424
#include "llvm/IR/PassManager.h"
25+
#include "llvm/MC/TargetRegistry.h"
2526
#include "llvm/Pass.h"
2627
#include "llvm/Support/ErrorHandling.h"
2728

@@ -72,10 +73,26 @@ static SmallVector<Value *> argVectorFlatten(CallInst *Orig,
7273
return NewOperands;
7374
}
7475

76+
static uint32_t getShaderModelVer(Module &M) {
77+
std::string TTStr = M.getTargetTriple();
78+
std::string Error;
79+
auto Target = TargetRegistry::lookupTarget(TTStr, Error);
80+
if (!Target) {
81+
if (TTStr.empty()) {
82+
report_fatal_error(StringRef(Error), /*gen_crash_diag*/ false);
83+
}
84+
}
85+
auto Major = Triple(TTStr).getOSVersion().getMajor();
86+
auto MinorOrErr = Triple(TTStr).getOSVersion().getMinor();
87+
uint32_t Minor = MinorOrErr.has_value() ? *MinorOrErr : 0;
88+
return ((Major * 10) + Minor);
89+
}
90+
7591
static void lowerIntrinsic(dxil::OpCode DXILOp, Function &F, Module &M) {
7692
IRBuilder<> B(M.getContext());
7793
DXILOpBuilder DXILB(M, B);
78-
Type *OverloadTy = DXILB.getOverloadTy(DXILOp, F.getFunctionType());
94+
uint32_t SMVer = getShaderModelVer(M);
95+
Type *OverloadTy = DXILB.getOverloadTy(DXILOp, SMVer, F.getFunctionType());
7996
for (User *U : make_early_inc_range(F.users())) {
8097
CallInst *CI = dyn_cast<CallInst>(U);
8198
if (!CI)
@@ -91,8 +108,8 @@ static void lowerIntrinsic(dxil::OpCode DXILOp, Function &F, Module &M) {
91108
} else
92109
Args.append(CI->arg_begin(), CI->arg_end());
93110

94-
CallInst *DXILCI =
95-
DXILB.createDXILOpCall(DXILOp, F.getReturnType(), OverloadTy, Args);
111+
CallInst *DXILCI = DXILB.createDXILOpCall(DXILOp, SMVer, F.getReturnType(),
112+
OverloadTy, Args);
96113

97114
CI->replaceAllUsesWith(DXILCI);
98115
CI->eraseFromParent();

llvm/test/CodeGen/DirectX/abs.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt -S -dxil-intrinsic-expansion < %s | FileCheck %s --check-prefixes=CHECK,EXPCHECK
2-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
2+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
33

44
; Make sure dxil operation function calls for abs are generated for int16_t/int/int64_t.
55

llvm/test/CodeGen/DirectX/ceil.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for ceil are generated for float and half.
44

@@ -18,3 +18,4 @@ entry:
1818

1919
declare half @llvm.ceil.f16(half)
2020
declare float @llvm.ceil.f32(float)
21+

llvm/test/CodeGen/DirectX/ceil_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation ceil does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload Type

llvm/test/CodeGen/DirectX/clamp.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for clamp/uclamp are generated for half/float/double/i16/i32/i64.
44

llvm/test/CodeGen/DirectX/cos.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for cos are generated for float and half.
44

llvm/test/CodeGen/DirectX/cos_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation cos does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload Type

llvm/test/CodeGen/DirectX/dot2_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation dot2 does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload

llvm/test/CodeGen/DirectX/dot3_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation dot3 does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload

llvm/test/CodeGen/DirectX/dot4_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation dot4 does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload

llvm/test/CodeGen/DirectX/exp.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for exp are generated for float and half.
44

llvm/test/CodeGen/DirectX/exp2_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation exp2 does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload

llvm/test/CodeGen/DirectX/fabs.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for abs are generated for float, half, and double.
44

5-
65
; CHECK-LABEL: fabs_half
76
define noundef half @fabs_half(half noundef %a) {
87
entry:

llvm/test/CodeGen/DirectX/fdot.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for dot are generated for int/uint vectors.
44

llvm/test/CodeGen/DirectX/floor.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for floor are generated for float and half.
44

llvm/test/CodeGen/DirectX/floor_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation floor does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload Type

llvm/test/CodeGen/DirectX/fmax.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for fmax are generated for half/float/double.
44

llvm/test/CodeGen/DirectX/fmin.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for fmin are generated for half/float/double.
44

llvm/test/CodeGen/DirectX/frac_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation frac does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload Type

llvm/test/CodeGen/DirectX/idot.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt -S -dxil-intrinsic-expansion < %s | FileCheck %s --check-prefixes=CHECK,EXPCHECK
2-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
2+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
33

44
; Make sure dxil operation function calls for dot are generated for int/uint vectors.
55

llvm/test/CodeGen/DirectX/isinf.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library < %s | FileCheck %s
22

33
; Make sure dxil operation function calls for isinf are generated for float and half.
44
; CHECK: call i1 @dx.op.isSpecialFloat.f32(i32 9, float %{{.*}})

llvm/test/CodeGen/DirectX/isinf_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation isinf does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload Type

llvm/test/CodeGen/DirectX/log.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt -S -dxil-intrinsic-expansion < %s | FileCheck %s --check-prefixes=CHECK,EXPCHECK
2-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
2+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
33

44
; Make sure dxil operation function calls for log are generated.
55

llvm/test/CodeGen/DirectX/log10.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt -S -dxil-intrinsic-expansion < %s | FileCheck %s --check-prefixes=CHECK,EXPCHECK
2-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
2+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
33

44
; Make sure dxil operation function calls for log10 are generated.
55

llvm/test/CodeGen/DirectX/log2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for log2 are generated for float and half.
44

llvm/test/CodeGen/DirectX/log2_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation log2 does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload Type

llvm/test/CodeGen/DirectX/pow.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt -S -dxil-intrinsic-expansion < %s | FileCheck %s --check-prefixes=CHECK,EXPCHECK
2-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
2+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK
33

44
; Make sure dxil operation function calls for pow are generated.
55

llvm/test/CodeGen/DirectX/reversebits.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for reversebits are generated for all integer types.
44

llvm/test/CodeGen/DirectX/round.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for round are generated for float and half.
44

llvm/test/CodeGen/DirectX/round_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; This test is expected to fail with the following error
44
; CHECK: LLVM ERROR: Invalid Overload Type

llvm/test/CodeGen/DirectX/rsqrt.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
22

33
; Make sure dxil operation function calls for rsqrt are generated for float and half.
44

llvm/test/CodeGen/DirectX/rsqrt_error.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: not opt -S -dxil-op-lower %s 2>&1 | FileCheck %s
1+
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
22

33
; DXIL operation rsqrt does not support double overload type
44
; CHECK: LLVM ERROR: Invalid Overload Type

llvm/test/CodeGen/DirectX/sin.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
1+
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library < %s | FileCheck %s -check-prefix=SM6_3
22

33
; Make sure dxil operation function calls for sin are generated for float and half.
4-
; CHECK:call float @dx.op.unary.f32(i32 13, float %{{.*}})
5-
; CHECK:call half @dx.op.unary.f16(i32 13, half %{{.*}})
64

75
; Function Attrs: noinline nounwind optnone
86
define noundef float @sin_float(float noundef %a) #0 {
97
entry:
108
%a.addr = alloca float, align 4
119
store float %a, ptr %a.addr, align 4
1210
%0 = load float, ptr %a.addr, align 4
11+
; SM6_3: call float @dx.op.unary.f32(i32 13, float %{{.*}})
1312
%1 = call float @llvm.sin.f32(float %0)
1413
ret float %1
1514
}
@@ -20,6 +19,7 @@ entry:
2019
%a.addr = alloca half, align 2
2120
store half %a, ptr %a.addr, align 2
2221
%0 = load half, ptr %a.addr, align 2
22+
; SM6_3: call half @dx.op.unary.f16(i32 13, half %{{.*}})
2323
%1 = call half @llvm.sin.f16(half %0)
2424
ret half %1
2525
}

0 commit comments

Comments
 (0)