1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -S -passes=instsimplify | FileCheck %s
4 declare i16 @llvm.bswap.i16(i16)
5 declare <2 x i16> @llvm.bswap.v2i16(<2 x i16>)
7 define i1 @test1(i16 %arg) {
9 ; CHECK-NEXT: ret i1 false
12 %b = call i16 @llvm.bswap.i16(i16 %a)
13 %res = icmp eq i16 %b, 0
17 define i1 @test1v(<2 x i16> %arg) {
18 ; CHECK-LABEL: @test1v(
19 ; CHECK-NEXT: ret i1 false
21 %a = or <2 x i16> %arg, <i16 1, i16 0>
22 %b = call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %a)
23 %c = extractelement <2 x i16> %b, i32 0
24 %res = icmp eq i16 %c, 0
28 define i1 @test2(i16 %arg) {
29 ; CHECK-LABEL: @test2(
30 ; CHECK-NEXT: ret i1 false
32 %a = or i16 %arg, 1024
33 %b = call i16 @llvm.bswap.i16(i16 %a)
34 %res = icmp eq i16 %b, 0
38 define i1 @test2v(<2 x i16> %arg) {
39 ; CHECK-LABEL: @test2v(
40 ; CHECK-NEXT: ret i1 false
42 %a = or <2 x i16> %arg, <i16 0, i16 1024>
43 %b = call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %a)
44 %c = extractelement <2 x i16> %b, i32 1
45 %res = icmp eq i16 %c, 0
49 define i1 @test3(i16 %arg) {
50 ; CHECK-LABEL: @test3(
51 ; CHECK-NEXT: ret i1 false
54 %b = call i16 @llvm.bswap.i16(i16 %a)
56 %res = icmp eq i16 %and, 1
60 define i1 @test3v(<2 x i16> %arg) {
61 ; CHECK-LABEL: @test3v(
62 ; CHECK-NEXT: ret i1 false
64 %a = and <2 x i16> %arg, <i16 1, i16 -1>
65 %b = call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %a)
66 %c = extractelement <2 x i16> %b, i32 0
68 %res = icmp eq i16 %and, 1
72 define i1 @test4(i16 %arg) {
73 ; CHECK-LABEL: @test4(
74 ; CHECK-NEXT: ret i1 false
76 %a = and i16 %arg, 511
77 %b = call i16 @llvm.bswap.i16(i16 %a)
78 %and = and i16 %b, 256
79 %res = icmp eq i16 %and, 1
83 define i1 @test4v(<2 x i16> %arg) {
84 ; CHECK-LABEL: @test4v(
85 ; CHECK-NEXT: ret i1 false
87 %a = and <2 x i16> %arg, <i16 511, i16 511>
88 %b = call <2 x i16> @llvm.bswap.v2i16(<2 x i16> %a)
89 %and = and <2 x i16> %b, <i16 255, i16 256>
90 %ext = extractelement <2 x i16> %and, i32 1
91 %res = icmp eq i16 %ext, 1