Skip to content

Commit

Permalink
[InstCombine] add test for possible sub->xor fold; NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
rotateright committed Jul 11, 2022
1 parent 4670c1e commit 835fd06
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions llvm/test/Transforms/InstCombine/sub-xor.ll
Expand Up @@ -36,6 +36,19 @@ define i8 @masked_sub_i8(i8 %x) {
ret i8 %m
}

; TODO: Borrow from the MSB is ok.

define i8 @masked_sub_high_bit_mask_i8(i8 %x) {
; CHECK-LABEL: @masked_sub_high_bit_mask_i8(
; CHECK-NEXT: [[MASKX:%.*]] = and i8 [[X:%.*]], -93
; CHECK-NEXT: [[S:%.*]] = sub i8 39, [[MASKX]]
; CHECK-NEXT: ret i8 [[S]]
;
%maskx = and i8 %x, 163 ; 0b10100011
%s = sub i8 39, %maskx ; 0b00100111
ret i8 %s
}

define <2 x i5> @masked_sub_v2i5(<2 x i5> %x) {
; CHECK-LABEL: @masked_sub_v2i5(
; CHECK-NEXT: [[A:%.*]] = and <2 x i5> [[X:%.*]], <i5 -8, i5 -8>
Expand Down

0 comments on commit 835fd06

Please sign in to comment.