aboutsummaryrefslogtreecommitdiffhomepage
path: root/ptx/src
diff options
context:
space:
mode:
Diffstat (limited to 'ptx/src')
-rw-r--r--ptx/src/pass/convert_to_typed.rs2
-rw-r--r--ptx/src/pass/insert_implicit_conversions.rs6
-rw-r--r--ptx/src/test/spirv_run/clz.spvtxt19
-rw-r--r--ptx/src/test/spirv_run/cvt_s16_s8.spvtxt7
-rw-r--r--ptx/src/test/spirv_run/cvt_s64_s32.spvtxt8
-rw-r--r--ptx/src/test/spirv_run/cvt_sat_s_u.spvtxt6
-rw-r--r--ptx/src/test/spirv_run/popc.spvtxt19
7 files changed, 42 insertions, 25 deletions
diff --git a/ptx/src/pass/convert_to_typed.rs b/ptx/src/pass/convert_to_typed.rs
index ab5b246..550c662 100644
--- a/ptx/src/pass/convert_to_typed.rs
+++ b/ptx/src/pass/convert_to_typed.rs
@@ -124,7 +124,7 @@ impl<'a, 'b> ast::VisitorMap<ast::ParsedOperand<SpirvWord>, TypedOperand, Transl
ast::ParsedOperand::Imm(x) => TypedOperand::Imm(x),
ast::ParsedOperand::VecMember(vec, idx) => TypedOperand::VecMember(vec, idx),
ast::ParsedOperand::VecPack(vec) => {
- let (type_, space) = type_space.ok_or(error_mismatched_type())?;
+ let (type_, space) = type_space.ok_or_else(|| error_mismatched_type())?;
TypedOperand::Reg(self.convert_vector(
is_dst,
relaxed_type_check,
diff --git a/ptx/src/pass/insert_implicit_conversions.rs b/ptx/src/pass/insert_implicit_conversions.rs
index 2857551..25e80f0 100644
--- a/ptx/src/pass/insert_implicit_conversions.rs
+++ b/ptx/src/pass/insert_implicit_conversions.rs
@@ -238,7 +238,7 @@ fn default_implicit_conversion_type(
if should_bitcast(instruction_type, operand_type) {
Ok(Some(ConversionKind::Default))
} else {
- Err(error_mismatched_type())
+ Err(TranslateError::MismatchedType)
}
} else {
Ok(Some(ConversionKind::PtrToPtr))
@@ -295,14 +295,14 @@ pub(crate) fn should_convert_relaxed_dst_wrapper(
(instruction_space, instruction_type): (ast::StateSpace, &ast::Type),
) -> Result<Option<ConversionKind>, TranslateError> {
if !space_is_compatible(operand_space, instruction_space) {
- return Err(error_mismatched_type());
+ return Err(TranslateError::MismatchedType);
}
if operand_type == instruction_type {
return Ok(None);
}
match should_convert_relaxed_dst(operand_type, instruction_type) {
conv @ Some(_) => Ok(conv),
- None => Err(error_mismatched_type()),
+ None => Err(TranslateError::MismatchedType),
}
}
diff --git a/ptx/src/test/spirv_run/clz.spvtxt b/ptx/src/test/spirv_run/clz.spvtxt
index 9a7f254..1feb5a0 100644
--- a/ptx/src/test/spirv_run/clz.spvtxt
+++ b/ptx/src/test/spirv_run/clz.spvtxt
@@ -7,20 +7,24 @@
OpCapability Int64
OpCapability Float16
OpCapability Float64
- %21 = OpExtInstImport "OpenCL.std"
+ OpCapability DenormFlushToZero
+ OpExtension "SPV_KHR_float_controls"
+ OpExtension "SPV_KHR_no_integer_wrap_decoration"
+ %22 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "clz"
+ OpExecutionMode %1 ContractionOff
%void = OpTypeVoid
%ulong = OpTypeInt 64 0
- %24 = OpTypeFunction %void %ulong %ulong
+ %25 = OpTypeFunction %void %ulong %ulong
%_ptr_Function_ulong = OpTypePointer Function %ulong
%uint = OpTypeInt 32 0
%_ptr_Function_uint = OpTypePointer Function %uint
%_ptr_Generic_uint = OpTypePointer Generic %uint
- %1 = OpFunction %void None %24
+ %1 = OpFunction %void None %25
%7 = OpFunctionParameter %ulong
%8 = OpFunctionParameter %ulong
- %19 = OpLabel
+ %20 = OpLabel
%2 = OpVariable %_ptr_Function_ulong Function
%3 = OpVariable %_ptr_Function_ulong Function
%4 = OpVariable %_ptr_Function_ulong Function
@@ -37,11 +41,12 @@
%11 = OpLoad %uint %17 Aligned 4
OpStore %6 %11
%14 = OpLoad %uint %6
- %13 = OpExtInst %uint %21 clz %14
+ %18 = OpExtInst %uint %22 clz %14
+ %13 = OpCopyObject %uint %18
OpStore %6 %13
%15 = OpLoad %ulong %5
%16 = OpLoad %uint %6
- %18 = OpConvertUToPtr %_ptr_Generic_uint %15
- OpStore %18 %16 Aligned 4
+ %19 = OpConvertUToPtr %_ptr_Generic_uint %15
+ OpStore %19 %16 Aligned 4
OpReturn
OpFunctionEnd
diff --git a/ptx/src/test/spirv_run/cvt_s16_s8.spvtxt b/ptx/src/test/spirv_run/cvt_s16_s8.spvtxt
index 5f4b050..92322ec 100644
--- a/ptx/src/test/spirv_run/cvt_s16_s8.spvtxt
+++ b/ptx/src/test/spirv_run/cvt_s16_s8.spvtxt
@@ -7,6 +7,9 @@
OpCapability Int64
OpCapability Float16
OpCapability Float64
+ OpCapability DenormFlushToZero
+ OpExtension "SPV_KHR_float_controls"
+ OpExtension "SPV_KHR_no_integer_wrap_decoration"
%24 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "cvt_s16_s8"
@@ -45,9 +48,7 @@
%32 = OpBitcast %uint %15
%34 = OpUConvert %uchar %32
%20 = OpCopyObject %uchar %34
- %35 = OpBitcast %uchar %20
- %37 = OpSConvert %ushort %35
- %19 = OpCopyObject %ushort %37
+ %19 = OpSConvert %ushort %20
%14 = OpSConvert %uint %19
OpStore %6 %14
%16 = OpLoad %ulong %5
diff --git a/ptx/src/test/spirv_run/cvt_s64_s32.spvtxt b/ptx/src/test/spirv_run/cvt_s64_s32.spvtxt
index 3f46103..1165290 100644
--- a/ptx/src/test/spirv_run/cvt_s64_s32.spvtxt
+++ b/ptx/src/test/spirv_run/cvt_s64_s32.spvtxt
@@ -7,9 +7,13 @@
OpCapability Int64
OpCapability Float16
OpCapability Float64
+ OpCapability DenormFlushToZero
+ OpExtension "SPV_KHR_float_controls"
+ OpExtension "SPV_KHR_no_integer_wrap_decoration"
%24 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "cvt_s64_s32"
+ OpExecutionMode %1 ContractionOff
%void = OpTypeVoid
%ulong = OpTypeInt 64 0
%27 = OpTypeFunction %void %ulong %ulong
@@ -40,9 +44,7 @@
%12 = OpCopyObject %uint %18
OpStore %6 %12
%15 = OpLoad %uint %6
- %32 = OpBitcast %uint %15
- %33 = OpSConvert %ulong %32
- %14 = OpCopyObject %ulong %33
+ %14 = OpSConvert %ulong %15
OpStore %7 %14
%16 = OpLoad %ulong %5
%17 = OpLoad %ulong %7
diff --git a/ptx/src/test/spirv_run/cvt_sat_s_u.spvtxt b/ptx/src/test/spirv_run/cvt_sat_s_u.spvtxt
index b676049..07b228e 100644
--- a/ptx/src/test/spirv_run/cvt_sat_s_u.spvtxt
+++ b/ptx/src/test/spirv_run/cvt_sat_s_u.spvtxt
@@ -7,9 +7,13 @@
OpCapability Int64
OpCapability Float16
OpCapability Float64
+ OpCapability DenormFlushToZero
+ OpExtension "SPV_KHR_float_controls"
+ OpExtension "SPV_KHR_no_integer_wrap_decoration"
%25 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "cvt_sat_s_u"
+ OpExecutionMode %1 ContractionOff
%void = OpTypeVoid
%ulong = OpTypeInt 64 0
%28 = OpTypeFunction %void %ulong %ulong
@@ -42,7 +46,7 @@
%15 = OpSatConvertSToU %uint %16
OpStore %7 %15
%18 = OpLoad %uint %7
- %17 = OpBitcast %uint %18
+ %17 = OpCopyObject %uint %18
OpStore %8 %17
%19 = OpLoad %ulong %5
%20 = OpLoad %uint %8
diff --git a/ptx/src/test/spirv_run/popc.spvtxt b/ptx/src/test/spirv_run/popc.spvtxt
index 845add7..c41e792 100644
--- a/ptx/src/test/spirv_run/popc.spvtxt
+++ b/ptx/src/test/spirv_run/popc.spvtxt
@@ -7,20 +7,24 @@
OpCapability Int64
OpCapability Float16
OpCapability Float64
- %21 = OpExtInstImport "OpenCL.std"
+ OpCapability DenormFlushToZero
+ OpExtension "SPV_KHR_float_controls"
+ OpExtension "SPV_KHR_no_integer_wrap_decoration"
+ %22 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %1 "popc"
+ OpExecutionMode %1 ContractionOff
%void = OpTypeVoid
%ulong = OpTypeInt 64 0
- %24 = OpTypeFunction %void %ulong %ulong
+ %25 = OpTypeFunction %void %ulong %ulong
%_ptr_Function_ulong = OpTypePointer Function %ulong
%uint = OpTypeInt 32 0
%_ptr_Function_uint = OpTypePointer Function %uint
%_ptr_Generic_uint = OpTypePointer Generic %uint
- %1 = OpFunction %void None %24
+ %1 = OpFunction %void None %25
%7 = OpFunctionParameter %ulong
%8 = OpFunctionParameter %ulong
- %19 = OpLabel
+ %20 = OpLabel
%2 = OpVariable %_ptr_Function_ulong Function
%3 = OpVariable %_ptr_Function_ulong Function
%4 = OpVariable %_ptr_Function_ulong Function
@@ -37,11 +41,12 @@
%11 = OpLoad %uint %17 Aligned 4
OpStore %6 %11
%14 = OpLoad %uint %6
- %13 = OpBitCount %uint %14
+ %18 = OpBitCount %uint %14
+ %13 = OpCopyObject %uint %18
OpStore %6 %13
%15 = OpLoad %ulong %5
%16 = OpLoad %uint %6
- %18 = OpConvertUToPtr %_ptr_Generic_uint %15
- OpStore %18 %16 Aligned 4
+ %19 = OpConvertUToPtr %_ptr_Generic_uint %15
+ OpStore %19 %16 Aligned 4
OpReturn
OpFunctionEnd