brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · c5f2087 Raw
128 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4; FIXME: Some of these tests belong in InstSimplify.5 6; Integer BitWidth <= 64 && BitWidth % 8 != 0.7 8define i39 @test0(i39 %A) {9; CHECK-LABEL: @test0(10; CHECK-NEXT:    ret i39 011;12  %B = and i39 %A, 0 ; zero result13  ret i39 %B14}15 16define i15 @test2(i15 %x) {17; CHECK-LABEL: @test2(18; CHECK-NEXT:    ret i15 [[X:%.*]]19;20  %tmp.2 = and i15 %x, -1 ; noop21  ret i15 %tmp.222}23 24define i23 @test3(i23 %x) {25; CHECK-LABEL: @test3(26; CHECK-NEXT:    ret i23 027;28  %tmp.0 = and i23 %x, 12729  %tmp.2 = and i23 %tmp.0, 12830  ret i23 %tmp.231}32 33define i1 @test4(i37 %x) {34; CHECK-LABEL: @test4(35; CHECK-NEXT:    [[B:%.*]] = icmp ugt i37 [[X:%.*]], 214748364736; CHECK-NEXT:    ret i1 [[B]]37;38  %A = and i37 %x, -214748364839  %B = icmp ne i37 %A, 040  ret i1 %B41}42 43define i7 @test5(i7 %A, ptr %P) {44; CHECK-LABEL: @test5(45; CHECK-NEXT:    [[TMP1:%.*]] = and i7 [[A:%.*]], -446; CHECK-NEXT:    [[C:%.*]] = xor i7 [[TMP1]], 1547; CHECK-NEXT:    store i7 [[C]], ptr [[P:%.*]], align 148; CHECK-NEXT:    ret i7 349;50  %B = or i7 %A, 351  %C = xor i7 %B, 1252  store i7 %C, ptr %P53  %r = and i7 %C, 354  ret i7 %r55}56 57define i47 @test7(i47 %A) {58; CHECK-LABEL: @test7(59; CHECK-NEXT:    [[TMP1:%.*]] = lshr i47 [[A:%.*]], 3960; CHECK-NEXT:    ret i47 [[TMP1]]61;62  %X = ashr i47 %A, 39 ;; sign extend63  %C1 = and i47 %X, 25564  ret i47 %C165}66 67; Integer BitWidth > 64 && BitWidth <= 1024.68 69define i999 @test8(i999 %A) {70; CHECK-LABEL: @test8(71; CHECK-NEXT:    ret i999 072;73  %B = and i999 %A, 0 ; zero result74  ret i999 %B75}76 77define i1005 @test9(i1005 %x) {78; CHECK-LABEL: @test9(79; CHECK-NEXT:    ret i1005 [[X:%.*]]80;81  %tmp.2 = and i1005 %x, -1 ; noop82  ret i1005 %tmp.283}84 85define i123 @test10(i123 %x) {86; CHECK-LABEL: @test10(87; CHECK-NEXT:    ret i123 088;89  %tmp.0 = and i123 %x, 12790  %tmp.2 = and i123 %tmp.0, 12891  ret i123 %tmp.292}93 94define i1 @test11(i737 %x) {95; CHECK-LABEL: @test11(96; CHECK-NEXT:    [[B:%.*]] = icmp ugt i737 [[X:%.*]], 214748364797; CHECK-NEXT:    ret i1 [[B]]98;99  %A = and i737 %x, -2147483648100  %B = icmp ne i737 %A, 0101  ret i1 %B102}103 104define i117 @test12(i117 %A, ptr %P) {105; CHECK-LABEL: @test12(106; CHECK-NEXT:    [[TMP1:%.*]] = and i117 [[A:%.*]], -4107; CHECK-NEXT:    [[C:%.*]] = xor i117 [[TMP1]], 15108; CHECK-NEXT:    store i117 [[C]], ptr [[P:%.*]], align 4109; CHECK-NEXT:    ret i117 3110;111  %B = or i117 %A, 3112  %C = xor i117 %B, 12113  store i117 %C, ptr %P114  %r = and i117 %C, 3115  ret i117 %r116}117 118define i1024 @test13(i1024 %A) {119; CHECK-LABEL: @test13(120; CHECK-NEXT:    [[TMP1:%.*]] = lshr i1024 [[A:%.*]], 1016121; CHECK-NEXT:    ret i1024 [[TMP1]]122;123  %X = ashr i1024 %A, 1016 ;; sign extend124  %C1 = and i1024 %X, 255125  ret i1024 %C1126}127 128