aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine/vector-casts.ll
blob: c6d1eaa1ff025b72080f372fd74111fbbfa443e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | FileCheck %s

; This turns into a&1 != 0
define <2 x i1> @test1(<2 x i64> %a) {
  %t = trunc <2 x i64> %a to <2 x i1>
  ret <2 x i1> %t

; CHECK: define <2 x i1> @test1
; CHECK:   and <2 x i64> %a, <i64 1, i64 1>
; CHECK:   icmp ne <2 x i64> %tmp, zeroinitializer
}

; The ashr turns into an lshr.
define <2 x i64> @test2(<2 x i64> %a) {
  %b = and <2 x i64> %a, <i64 65535, i64 65535>
  %t = ashr <2 x i64> %b, <i64 1, i64 1>
  ret <2 x i64> %t

; CHECK: define <2 x i64> @test2
; CHECK:   and <2 x i64> %a, <i64 65535, i64 65535>
; CHECK:   lshr <2 x i64> %b, <i64 1, i64 1>
}