
- Redefines `DXILAttribute` to denote a function attribute, compatible to how it was define in DXC/LLVM 3.7 - Fix how `DXILAttribute` is emitted to be a struct of set attributes instead of an "or" of the enums - Implement the lowering of `DXILAttribute` to LLVM function attributes in `DXILOpBuilder.cpp`. A custom mapping is defined. - Audit all current ops to specify the correct attributes consistent with DXC. This is done here to allow for testing. - Update testcases in `llvm/test/CodeGen/DirectX` of all ops with attributes to match that attributes are set - Update testcases of ops that had previously incorrectly set attributes to check there is no attributes set - Defines `DXILProperty` to denote the other type of attributes from DXC used to query properties. - Emit `DXILProperty` as a struct of set attributes. - Updates `DXIL.td` to specify applicable `DXILProperty`s on ops Note: `DXILProperty` was referred to as 'queryable attributes' in design discussion. Changed to property to allow for better expression in `DXIL.td` Resolves #114461 Resolves #115912
69 lines
2.8 KiB
LLVM
69 lines
2.8 KiB
LLVM
; RUN: opt -S -dxil-op-lower < %s | FileCheck %s
|
|
|
|
; Make sure dxil operation function calls for round are generated for float and half.
|
|
; CHECK:call half @dx.op.tertiary.f16(i32 46, half %{{.*}}, half %{{.*}}, half %{{.*}}) #[[#ATTR:]]
|
|
; CHECK:call float @dx.op.tertiary.f32(i32 46, float %{{.*}}, float %{{.*}}, float %{{.*}}) #[[#ATTR]]
|
|
; CHECK:call double @dx.op.tertiary.f64(i32 46, double %{{.*}}, double %{{.*}}, double %{{.*}}) #[[#ATTR]]
|
|
|
|
; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}
|
|
|
|
target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
|
|
target triple = "dxil-pc-shadermodel6.7-library"
|
|
|
|
; Function Attrs: noinline nounwind optnone
|
|
define noundef half @fmad_half(half noundef %p0, half noundef %p1, half noundef %p2) #0 {
|
|
entry:
|
|
%p2.addr = alloca half, align 2
|
|
%p1.addr = alloca half, align 2
|
|
%p0.addr = alloca half, align 2
|
|
store half %p2, ptr %p2.addr, align 2
|
|
store half %p1, ptr %p1.addr, align 2
|
|
store half %p0, ptr %p0.addr, align 2
|
|
%0 = load half, ptr %p0.addr, align 2
|
|
%1 = load half, ptr %p1.addr, align 2
|
|
%2 = load half, ptr %p2.addr, align 2
|
|
%hlsl.fmad = call half @llvm.fmuladd.f16(half %0, half %1, half %2)
|
|
ret half %hlsl.fmad
|
|
}
|
|
|
|
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
|
declare half @llvm.fmuladd.f16(half, half, half) #2
|
|
|
|
; Function Attrs: noinline nounwind optnone
|
|
define noundef float @fmad_float(float noundef %p0, float noundef %p1, float noundef %p2) #0 {
|
|
entry:
|
|
%p2.addr = alloca float, align 4
|
|
%p1.addr = alloca float, align 4
|
|
%p0.addr = alloca float, align 4
|
|
store float %p2, ptr %p2.addr, align 4
|
|
store float %p1, ptr %p1.addr, align 4
|
|
store float %p0, ptr %p0.addr, align 4
|
|
%0 = load float, ptr %p0.addr, align 4
|
|
%1 = load float, ptr %p1.addr, align 4
|
|
%2 = load float, ptr %p2.addr, align 4
|
|
%hlsl.fmad = call float @llvm.fmuladd.f32(float %0, float %1, float %2)
|
|
ret float %hlsl.fmad
|
|
}
|
|
|
|
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
|
declare float @llvm.fmuladd.f32(float, float, float) #2
|
|
|
|
; Function Attrs: noinline nounwind optnone
|
|
define noundef double @fmad_double(double noundef %p0, double noundef %p1, double noundef %p2) #0 {
|
|
entry:
|
|
%p2.addr = alloca double, align 8
|
|
%p1.addr = alloca double, align 8
|
|
%p0.addr = alloca double, align 8
|
|
store double %p2, ptr %p2.addr, align 8
|
|
store double %p1, ptr %p1.addr, align 8
|
|
store double %p0, ptr %p0.addr, align 8
|
|
%0 = load double, ptr %p0.addr, align 8
|
|
%1 = load double, ptr %p1.addr, align 8
|
|
%2 = load double, ptr %p2.addr, align 8
|
|
%hlsl.fmad = call double @llvm.fmuladd.f64(double %0, double %1, double %2)
|
|
ret double %hlsl.fmad
|
|
}
|
|
|
|
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
|
declare double @llvm.fmuladd.f64(double, double, double) #2
|