-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -codegenprepare -S < %s | FileCheck %s
; RUN: opt -enable-debugify -codegenprepare -S < %s 2>&1 | FileCheck %s -check-prefix=DEBUG
; Constant operand should match.
-define i1 @usubo_ugt_constant_op1_i8(i8 %x, i8* %p) {
-; CHECK-LABEL: @usubo_ugt_constant_op1_i8(
+define i1 @usubo_ugt_constant_op0_i8(i8 %x, i8* %p) {
+; CHECK-LABEL: @usubo_ugt_constant_op0_i8(
; CHECK-NEXT: [[S:%.*]] = sub i8 42, [[X:%.*]]
; CHECK-NEXT: [[OV:%.*]] = icmp ugt i8 [[X]], 42
; CHECK-NEXT: store i8 [[S]], i8* [[P:%.*]]
; Compare with constant operand 0 is canonicalized by commuting, but verify match for non-canonical form.
-define i1 @usubo_ult_constant_op1_i16(i16 %x, i16* %p) {
-; CHECK-LABEL: @usubo_ult_constant_op1_i16(
+define i1 @usubo_ult_constant_op0_i16(i16 %x, i16* %p) {
+; CHECK-LABEL: @usubo_ult_constant_op0_i16(
; CHECK-NEXT: [[S:%.*]] = sub i16 43, [[X:%.*]]
; CHECK-NEXT: [[OV:%.*]] = icmp ult i16 43, [[X]]
; CHECK-NEXT: store i16 [[S]], i16* [[P:%.*]]
ret i1 %ov
}
-; Subtract with constant operand 0 is canonicalized to add.
+; Subtract with constant operand 1 is canonicalized to add.
-define i1 @usubo_ult_constant_op0_i16(i16 %x, i16* %p) {
-; CHECK-LABEL: @usubo_ult_constant_op0_i16(
+define i1 @usubo_ult_constant_op1_i16(i16 %x, i16* %p) {
+; CHECK-LABEL: @usubo_ult_constant_op1_i16(
; CHECK-NEXT: [[S:%.*]] = add i16 [[X:%.*]], -44
; CHECK-NEXT: [[OV:%.*]] = icmp ult i16 [[X]], 44
; CHECK-NEXT: store i16 [[S]], i16* [[P:%.*]]
ret i1 %ov
}
-define i1 @usubo_ugt_constant_op0_i8(i8 %x, i8* %p) {
-; CHECK-LABEL: @usubo_ugt_constant_op0_i8(
+define i1 @usubo_ugt_constant_op1_i8(i8 %x, i8* %p) {
+; CHECK-LABEL: @usubo_ugt_constant_op1_i8(
; CHECK-NEXT: [[S:%.*]] = add i8 [[X:%.*]], -45
; CHECK-NEXT: [[OV:%.*]] = icmp ugt i8 45, [[X]]
; CHECK-NEXT: store i8 [[S]], i8* [[P:%.*]]