brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 07a0e49 Raw
65 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 42; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4; These tests are for Integer BitWidth <= 64 && BitWidth % 2 != 0.5;; A | ~A == -16define i23 @test1(i23 %A) {7; CHECK-LABEL: define i23 @test1(8; CHECK-SAME: i23 [[A:%.*]]) {9; CHECK-NEXT:    ret i23 -110;11  %NotA = xor i23 -1, %A12  %B = or i23 %A, %NotA13  ret i23 %B14}15 16;; If we have: ((V + N) & C1) | (V & C2)17;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 018;; replace with V+N.19define i39 @test2(i39 %V, i39 %M) {20; CHECK-LABEL: define i39 @test2(21; CHECK-SAME: i39 [[V:%.*]], i39 [[M:%.*]]) {22; CHECK-NEXT:    [[N:%.*]] = and i39 [[M]], -27487790694423; CHECK-NEXT:    [[A:%.*]] = add i39 [[V]], [[N]]24; CHECK-NEXT:    ret i39 [[A]]25;26  %C1 = xor i39 274877906943, -1 ;; C2 = 27487790694327  %N = and i39 %M, 27487790694428  %A = add i39 %V, %N29  %B = and i39 %A, %C130  %D = and i39 %V, 27487790694331  %R = or i39 %B, %D32  ret i39 %R33}34 35; These tests are for Integer BitWidth > 64 && BitWidth <= 1024.36;; A | ~A == -137define i1023 @test4(i1023 %A) {38; CHECK-LABEL: define i1023 @test4(39; CHECK-SAME: i1023 [[A:%.*]]) {40; CHECK-NEXT:    ret i1023 -141;42  %NotA = xor i1023 -1, %A43  %B = or i1023 %A, %NotA44  ret i1023 %B45}46 47;; If we have: ((V + N) & C1) | (V & C2)48;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 049;; replace with V+N.50define i399 @test5(i399 %V, i399 %M) {51; CHECK-LABEL: define i399 @test5(52; CHECK-SAME: i399 [[V:%.*]], i399 [[M:%.*]]) {53; CHECK-NEXT:    [[N:%.*]] = and i399 [[M]], 1844674297419792384054; CHECK-NEXT:    [[A:%.*]] = add i399 [[V]], [[N]]55; CHECK-NEXT:    ret i399 [[A]]56;57  %C1 = xor i399 274877906943, -1 ;; C2 = 27487790694358  %N = and i399 %M, 1844674297419792384059  %A = add i399 %V, %N60  %B = and i399 %A, %C161  %D = and i399 %V, 27487790694362  %R = or i399 %B, %D63  ret i399 %R64}65