Skip to content

Commit

Permalink
[InstCombine] add vector tests for truncated math; NFC
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310122 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rotateright committed Aug 4, 2017
1 parent 5b11a64 commit 310c521
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/Transforms/InstCombine/trunc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -533,3 +533,25 @@ define <8 x i8> @wide_lengthening_splat(<4 x i16> %v) {
ret <8 x i8> %tr
}

define <2 x i8> @narrow_add_vec_constant(<2 x i32> %x) {
; CHECK-LABEL: @narrow_add_vec_constant(
; CHECK-NEXT: [[ADD:%.*]] = add <2 x i32> %x, <i32 256, i32 -129>
; CHECK-NEXT: [[TR:%.*]] = trunc <2 x i32> [[ADD]] to <2 x i8>
; CHECK-NEXT: ret <2 x i8> [[TR]]
;
%add = add <2 x i32> %x, <i32 256, i32 -129>
%tr = trunc <2 x i32> %add to <2 x i8>
ret <2 x i8> %tr
}

define <2 x i8> @narrow_sub_vec_constant(<2 x i32> %x) {
; CHECK-LABEL: @narrow_sub_vec_constant(
; CHECK-NEXT: [[SUB:%.*]] = sub <2 x i32> <i32 256, i32 -129>, %x
; CHECK-NEXT: [[TR:%.*]] = trunc <2 x i32> [[SUB]] to <2 x i8>
; CHECK-NEXT: ret <2 x i8> [[TR]]
;
%sub = sub <2 x i32> <i32 256, i32 -129>, %x
%tr = trunc <2 x i32> %sub to <2 x i8>
ret <2 x i8> %tr
}

0 comments on commit 310c521

Please sign in to comment.