To consolidate behavior of function mangling and limit the number of places that ABI changes will need to be made, this switches the DirectX target used for HLSL to use the Itanium ABI from the Microsoft ABI. The Itanium ABI has greater flexibility in decisions regarding mangling of new types of which we have more than a few yet to add. One effect of this will be that linking library shaders compiled with DXC will not be possible with shaders compiled with clang. That isn't considered a terribly interesting use case and one that would likely have been onerous to maintain anyway. This involved adding a function to call all global destructors as the Microsoft ABI had done. This requires a few changes to tests. Most notably the mangling style has changed which accounts for most of the changes. In making those changes, I took the opportunity to harmonize some very similar tests for greater consistency. I also shaved off some unneeded run flags that had probably been copied over from one test to another. Other changes effected by using the new ABI include using different types when manipulating smaller bitfields, eliminating an unnecessary alloca in one instance in this-assignment.hlsl, changing the way static local initialization is guarded, and changing the order of inout parameters getting copied in and out. That last is a subtle change in functionality, but one where there was sufficient inconsistency in the past that standardizing is important, but the particular direction of the standardization is less important for the sake of existing shaders. fixes #110736
67 lines
2.1 KiB
HLSL
67 lines
2.1 KiB
HLSL
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \
|
|
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
|
|
|
|
int shl32(int V, int S) {
|
|
return V << S;
|
|
}
|
|
|
|
// CHECK-LABEL: define noundef i32 @_Z5shl32ii(i32 noundef %V, i32 noundef %S) #0 {
|
|
// CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31
|
|
// CHECK-DAG: %{{.*}} = shl i32 %{{.*}}, %[[Masked]]
|
|
|
|
int shr32(int V, int S) {
|
|
return V >> S;
|
|
}
|
|
|
|
// CHECK-LABEL: define noundef i32 @_Z5shr32ii(i32 noundef %V, i32 noundef %S) #0 {
|
|
// CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31
|
|
// CHECK-DAG: %{{.*}} = ashr i32 %{{.*}}, %[[Masked]]
|
|
|
|
int64_t shl64(int64_t V, int64_t S) {
|
|
return V << S;
|
|
}
|
|
|
|
// CHECK-LABEL: define noundef i64 @_Z5shl64ll(i64 noundef %V, i64 noundef %S) #0 {
|
|
// CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63
|
|
// CHECK-DAG: %{{.*}} = shl i64 %{{.*}}, %[[Masked]]
|
|
|
|
int64_t shr64(int64_t V, int64_t S) {
|
|
return V >> S;
|
|
}
|
|
|
|
// CHECK-LABEL: define noundef i64 @_Z5shr64ll(i64 noundef %V, i64 noundef %S) #0 {
|
|
// CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63
|
|
// CHECK-DAG: %{{.*}} = ashr i64 %{{.*}}, %[[Masked]]
|
|
|
|
uint shlu32(uint V, uint S) {
|
|
return V << S;
|
|
}
|
|
|
|
// CHECK-LABEL: define noundef i32 @_Z6shlu32jj(i32 noundef %V, i32 noundef %S) #0 {
|
|
// CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31
|
|
// CHECK-DAG: %{{.*}} = shl i32 %{{.*}}, %[[Masked]]
|
|
|
|
uint shru32(uint V, uint S) {
|
|
return V >> S;
|
|
}
|
|
|
|
// CHECK-LABEL: define noundef i32 @_Z6shru32jj(i32 noundef %V, i32 noundef %S) #0 {
|
|
// CHECK-DAG: %[[Masked:.*]] = and i32 %{{.*}}, 31
|
|
// CHECK-DAG: %{{.*}} = lshr i32 %{{.*}}, %[[Masked]]
|
|
|
|
uint64_t shlu64(uint64_t V, uint64_t S) {
|
|
return V << S;
|
|
}
|
|
|
|
// CHECK-LABEL: define noundef i64 @_Z6shlu64mm(i64 noundef %V, i64 noundef %S) #0 {
|
|
// CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63
|
|
// CHECK-DAG: %{{.*}} = shl i64 %{{.*}}, %[[Masked]]
|
|
|
|
uint64_t shru64(uint64_t V, uint64_t S) {
|
|
return V >> S;
|
|
}
|
|
|
|
// CHECK-LABEL: define noundef i64 @_Z6shru64mm(i64 noundef %V, i64 noundef %S) #0 {
|
|
// CHECK-DAG: %[[Masked:.*]] = and i64 %{{.*}}, 63
|
|
// CHECK-DAG: %{{.*}} = lshr i64 %{{.*}}, %[[Masked]]
|