Skip to content

Commit 312c90d

Browse files
committed
[InstCombine][NFC] Precommit testcase for and-sub combine.
1 parent a1d71c3 commit 312c90d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt < %s -passes=instcombine -mtriple=x86_64-unknown-unknown -S | FileCheck %s
3+
4+
define i8 @and_sub(i8 %a) {
5+
; CHECK-LABEL: @and_sub(
6+
; CHECK-NEXT: [[AND1:%.*]] = and i8 [[A:%.*]], 15
7+
; CHECK-NEXT: [[AND2:%.*]] = and i8 [[A]], 3
8+
; CHECK-NEXT: [[RET:%.*]] = sub nsw i8 [[AND1]], [[AND2]]
9+
; CHECK-NEXT: ret i8 [[RET]]
10+
;
11+
%and1 = and i8 %a, 15
12+
%and2 = and i8 %a, 3
13+
14+
%ret = sub i8 %and1, %and2
15+
ret i8 %ret
16+
}

0 commit comments

Comments
 (0)