1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -S -passes=instsimplify | FileCheck %s 3 4declare i16 @llvm.bswap.i16(i16) 5declare <2 x i16> @llvm.bswap.v2i16(<2 x i16>) 6 7define i1 @test1(i16 %arg) { 8; CHECK-LABEL: @test1( 9; CHECK-NEXT: ret i1 false 10; 11 %a = or i16 %arg, 1 12 %b = call i16 @llvm.bswap.i16(i16 %a) 13 %res = icmp eq i16 %b, 0 14 ret i1 %res 15} 16 17define i1 @test1v(<2 x i16> %arg) { 18; CHECK-LABEL: @test1v( 19; CHECK-NEXT: ret i1 false 20; 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 25 ret i1 %res 26} 27 28define i1 @test2(i16 %arg) { 29; CHECK-LABEL: @test2( 30; CHECK-NEXT: ret i1 false 31; 32 %a = or i16 %arg, 1024 33 %b = call i16 @llvm.bswap.i16(i16 %a) 34 %res = icmp eq i16 %b, 0 35 ret i1 %res 36} 37 38define i1 @test2v(<2 x i16> %arg) { 39; CHECK-LABEL: @test2v( 40; CHECK-NEXT: ret i1 false 41; 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 46 ret i1 %res 47} 48 49define i1 @test3(i16 %arg) { 50; CHECK-LABEL: @test3( 51; CHECK-NEXT: ret i1 false 52; 53 %a = and i16 %arg, 1 54 %b = call i16 @llvm.bswap.i16(i16 %a) 55 %and = and i16 %b, 1 56 %res = icmp eq i16 %and, 1 57 ret i1 %res 58} 59 60define i1 @test3v(<2 x i16> %arg) { 61; CHECK-LABEL: @test3v( 62; CHECK-NEXT: ret i1 false 63; 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 67 %and = and i16 %c, 1 68 %res = icmp eq i16 %and, 1 69 ret i1 %res 70} 71 72define i1 @test4(i16 %arg) { 73; CHECK-LABEL: @test4( 74; CHECK-NEXT: ret i1 false 75; 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 80 ret i1 %res 81} 82 83define i1 @test4v(<2 x i16> %arg) { 84; CHECK-LABEL: @test4v( 85; CHECK-NEXT: ret i1 false 86; 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 92 ret i1 %res 93} 94