[llvm] [IR] Add nowrap flags for trunc instruction (PR #85592)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 04:11:50 PDT 2024


================
@@ -261,3 +261,27 @@ define i64 @test_or(i64 %a, i64 %b) {
   %res = or disjoint i64 %a, %b
   ret i64 %res
 }
+
+define i32 @test_trunc_signed(i64 %a) {
+; CHECK: %res = trunc nsw i64 %a to i32
+  %res = trunc nsw i64 %a to i32
+  ret i32 %res
+}
+
+define i32 @test_trunc_unsigned(i64 %a) {
+; CHECK: %res = trunc nuw i64 %a to i32
+	%res = trunc nuw i64 %a to i32
----------------
nikic wrote:

Broken indent here.

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


More information about the llvm-commits mailing list