[llvm] [NVPTX] Implement isTruncateFree and isZExtFree for i32/i64 Optimizations (PR #114683)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 10:46:38 PST 2024


================
@@ -0,0 +1,17 @@
+; 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: trunc
+  %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: zext
+  %zext = zext i32 %val to i64
+  ret i64 %zext
+}
----------------
justinfargnoli wrote:

Add a new line at the end of the file. 

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


More information about the llvm-commits mailing list