[llvm] [InstCombine] Pattern match minmax calls for unsigned saturation. (PR #99250)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 19 01:19:59 PDT 2024
================
@@ -0,0 +1,517 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
+
+define i32 @uadd_sat32(i32 %a, i32 %b) {
+; CHECK-LABEL: define i32 @uadd_sat32(
+; CHECK-SAME: i32 [[A:%.*]], i32 [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[TMP0:%.*]] = call i32 @llvm.uadd.sat.i32(i32 [[B]], i32 [[A]])
+; CHECK-NEXT: ret i32 [[TMP0]]
+;
+entry:
+ %conv = zext i32 %a to i64
+ %conv1 = zext i32 %b to i64
+ %add = add i64 %conv1, %conv
+ %0 = icmp ult i64 %add, 4294967295
----------------
dtcxzyw wrote:
Use named values.
https://github.com/llvm/llvm-project/pull/99250
More information about the llvm-commits
mailing list