brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · a7732f0 Raw
51 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=aggressive-instcombine -S < %s | FileCheck %s3 4;; C reproducers:5;; #include "stdio.h"6;; unsigned x;7;;8;; int test ()9;; {10;;  static const char table[32] =11;;    {12;;      0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,13;;      31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 914;;    };15;;  return table[((unsigned)((x & -x) * 0x077CB531U)) >> 27];16;; }17;;18 19@x = global i32 0, align 420@.str = private constant [3 x i8] c"%u\00", align 121@test.table = internal constant [32 x i8] c"\00\01\1C\02\1D\0E\18\03\1E\16\14\0F\19\11\04\08\1F\1B\0D\17\15\13\10\07\1A\0C\12\06\0B\05\0A\09", align 122 23define i32 @test() !prof !0 {24; CHECK-LABEL: @test(25; CHECK: !prof [[PROF_0:![0-9]+]] {26; CHECK-NEXT:  entry:27; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr @x, align 428; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @llvm.cttz.i32(i32 [[TMP0]], i1 true)29; CHECK-NEXT:    [[TMP2:%.*]] = icmp eq i32 [[TMP0]], 030; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP2]], i32 0, i32 [[TMP1]], !prof [[PROF_1:![0-9]+]]31; CHECK-NEXT:    [[TMP4:%.*]] = trunc i32 [[TMP3]] to i832; CHECK-NEXT:    [[CONV:%.*]] = zext i8 [[TMP4]] to i3233; CHECK-NEXT:    ret i32 [[CONV]]34;35entry:36  %0 = load i32, ptr @x, align 437  %sub = sub i32 0, %038  %and = and i32 %0, %sub39  %mul = mul i32 %and, 12561336140  %shr = lshr i32 %mul, 2741  %idxprom = zext i32 %shr to i6442  %arrayidx = getelementptr inbounds [32 x i8], ptr @test.table, i64 0, i64 %idxprom43  %1 = load i8, ptr %arrayidx, align 144  %conv = zext i8 %1 to i3245  ret i32 %conv46}47 48!0 = !{!"function_entry_count", i64 1000}49; CHECK: [[PROF_0]] = !{!"function_entry_count", i64 1000}50; CHECK: [[PROF_1]] = !{!"branch_weights", i32 1, i32 1048575}51