[llvm] [NVPTX] Implemented istruncatefree and iszextfree alongwith test cases. (PR #115139)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 10:43:13 PST 2024


================
@@ -0,0 +1,54 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc -march=nvptx64 < %s | FileCheck %s
+
+; Test for truncation from i64 to i32
+define i32 @test_trunc_i64_to_i32(i64 %val) {
+; CHECK-LABEL: test_trunc_i64_to_i32(
+; CHECK:       {
+; CHECK-NEXT:    .reg .b32 %r<2>;
+; CHECK-EMPTY:
+; CHECK-NEXT:  // %bb.0:
+; CHECK-NEXT:    ld.param.u32 %r1, [test_trunc_i64_to_i32_param_0];
+; CHECK-NEXT:    st.param.b32 [func_retval0], %r1;
+; CHECK-NEXT:    ret;
+  %trunc = trunc i64 %val to i32
+  ret i32 %trunc
+}
+
+; Test for zero-extension from i32 to i64
+define i64 @test_zext_i32_to_i64(i32 %val) {
+; CHECK-LABEL: test_zext_i32_to_i64(
+; CHECK:       {
+; CHECK-NEXT:    .reg .b64 %rd<2>;
+; CHECK-EMPTY:
+; CHECK-NEXT:  // %bb.0:
+; CHECK-NEXT:    ld.param.u32 %rd1, [test_zext_i32_to_i64_param_0];
+; CHECK-NEXT:    st.param.b64 [func_retval0], %rd1;
+; CHECK-NEXT:    ret;
+  %zext = zext i32 %val to i64
+  ret i64 %zext
+}
----------------
justinfargnoli wrote:

Since these tests aren't checking the code that we're modifying, we can delete it from the test. 

https://github.com/llvm/llvm-project/pull/115139


More information about the llvm-commits mailing list