Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=mipsel -O3 -relocation-model=pic < %s | FileCheck %s |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 2 | |
| 3 | |
| 4 | ; MIPS direct branches implicitly define register $at. This test makes sure that |
| 5 | ; code hoisting optimization (which moves identical instructions at the start of |
| 6 | ; two basic blocks to the common predecessor block) takes this into account and |
| 7 | ; doesn't move definition of $at to the predecessor block (which would make $at |
| 8 | ; live-in at the start of successor block). |
| 9 | |
| 10 | |
| 11 | ; CHECK-LABEL: readLumaCoeff8x8_CABAC |
| 12 | |
Sasa Stankovic | 7072a79 | 2014-10-01 08:22:21 +0000 | [diff] [blame] | 13 | ; The check for first "addiu" instruction is added so that we can match the correct "b" instruction. |
Chuang-Yu Cheng | d3fb38c | 2016-04-05 14:06:20 +0000 | [diff] [blame] | 14 | ; CHECK: andi |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 15 | ; CHECK: b $[[BB0:BB[0-9_]+]] |
Simon Dardis | bd27154 | 2016-09-01 14:53:53 +0000 | [diff] [blame] | 16 | ; CHECK: sll |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 17 | |
Sasa Stankovic | 7072a79 | 2014-10-01 08:22:21 +0000 | [diff] [blame] | 18 | ; Check that at the start of a fallthrough block there is a instruction that writes to $1. |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 19 | ; CHECK: {{%bb.[0-9]+}}: |
Simon Dardis | bd27154 | 2016-09-01 14:53:53 +0000 | [diff] [blame] | 20 | ; CHECK: sll $1, $[[R0:[0-9]+]], 4 |
| 21 | ; CHECK: lw $[[R1:[0-9]+]], %got(assignSE2partition)($[[R2:[0-9]+]]) |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 22 | |
Sasa Stankovic | 7072a79 | 2014-10-01 08:22:21 +0000 | [diff] [blame] | 23 | ; Check that identical instructions are at the start of a target block. |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 24 | ; CHECK: [[BB0]]: |
Simon Dardis | bd27154 | 2016-09-01 14:53:53 +0000 | [diff] [blame] | 25 | ; CHECK: sll $1, $[[R0]], 4 |
| 26 | ; CHECK: lw $[[R1]], %got(assignSE2partition)($[[R2]]) |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 27 | |
| 28 | |
| 29 | %struct.img_par = type { i32, i32, i32, i32, i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x [16 x i16]], [6 x [32 x i32]], [16 x [16 x i32]], [4 x [12 x [4 x [4 x i32]]]], [16 x i32], i8**, i32*, i32***, i32**, i32, i32, i32, i32, %struct.Slice*, %struct.macroblock*, i32, i32, i32, i32, i32, i32, %struct.DecRefPicMarking_s*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32***, i32***, i32****, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x [2 x i32]], [3 x [2 x i32]], i32, i32, i32, i32, %struct.timeb, %struct.timeb, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } |
| 30 | %struct.Slice = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.datapartition*, %struct.MotionInfoContexts*, %struct.TextureInfoContexts*, i32, i32*, i32*, i32*, i32, i32*, i32*, i32*, i32 (%struct.img_par*, %struct.inp_par*)*, i32, i32, i32, i32 } |
| 31 | %struct.datapartition = type { %struct.Bitstream*, %struct.DecodingEnvironment, i32 (%struct.syntaxelement*, %struct.img_par*, %struct.datapartition*)* } |
| 32 | %struct.Bitstream = type { i32, i32, i32, i32, i8*, i32 } |
| 33 | %struct.DecodingEnvironment = type { i32, i32, i32, i32, i32, i8*, i32* } |
| 34 | %struct.syntaxelement = type { i32, i32, i32, i32, i32, i32, i32, i32, void (i32, i32, i32*, i32*)*, void (%struct.syntaxelement*, %struct.img_par*, %struct.DecodingEnvironment*)* } |
| 35 | %struct.MotionInfoContexts = type { [4 x [11 x %struct.BiContextType]], [2 x [9 x %struct.BiContextType]], [2 x [10 x %struct.BiContextType]], [2 x [6 x %struct.BiContextType]], [4 x %struct.BiContextType], [4 x %struct.BiContextType], [3 x %struct.BiContextType] } |
| 36 | %struct.BiContextType = type { i16, i8 } |
| 37 | %struct.TextureInfoContexts = type { [2 x %struct.BiContextType], [4 x %struct.BiContextType], [3 x [4 x %struct.BiContextType]], [10 x [4 x %struct.BiContextType]], [10 x [15 x %struct.BiContextType]], [10 x [15 x %struct.BiContextType]], [10 x [5 x %struct.BiContextType]], [10 x [5 x %struct.BiContextType]], [10 x [15 x %struct.BiContextType]], [10 x [15 x %struct.BiContextType]] } |
| 38 | %struct.inp_par = type { [1000 x i8], [1000 x i8], [1000 x i8], i32, i32, i32, i32, i32, i32, i32, i32 } |
| 39 | %struct.macroblock = type { i32, [2 x i32], i32, i32, %struct.macroblock*, %struct.macroblock*, i32, [2 x [4 x [4 x [2 x i32]]]], i32, i64, i64, i32, i32, [4 x i8], [4 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } |
| 40 | %struct.DecRefPicMarking_s = type { i32, i32, i32, i32, i32, %struct.DecRefPicMarking_s* } |
| 41 | %struct.timeb = type { i32, i16, i16, i16 } |
| 42 | |
| 43 | @assignSE2partition = external global [0 x [20 x i32]] |
| 44 | @FIELD_SCAN8x8 = external constant [64 x [2 x i8]] |
| 45 | |
| 46 | |
| 47 | define void @readLumaCoeff8x8_CABAC(%struct.img_par* %img, i32 %b8) { |
| 48 | |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 49 | %1 = load i32, i32* undef, align 4 |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 50 | br i1 false, label %2, label %3 |
| 51 | |
| 52 | ; <label>:2 ; preds = %0 |
| 53 | br label %3 |
| 54 | |
| 55 | ; <label>:3 ; preds = %2, %0 |
| 56 | br i1 undef, label %switch.lookup, label %4 |
| 57 | |
| 58 | switch.lookup: ; preds = %3 |
| 59 | br label %4 |
| 60 | |
| 61 | ; <label>:4 ; preds = %switch.lookup, %3 |
| 62 | br i1 undef, label %5, label %6 |
| 63 | |
| 64 | ; <label>:5 ; preds = %4 |
| 65 | br label %6 |
| 66 | |
| 67 | ; <label>:6 ; preds = %5, %4 |
David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 68 | %7 = phi [2 x i8]* [ getelementptr inbounds ([64 x [2 x i8]], [64 x [2 x i8]]* @FIELD_SCAN8x8, i32 0, i32 0), %4 ], [ null, %5 ] |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 69 | br i1 undef, label %switch.lookup6, label %8 |
| 70 | |
| 71 | switch.lookup6: ; preds = %6 |
| 72 | br label %8 |
| 73 | |
| 74 | ; <label>:8 ; preds = %switch.lookup6, %6 |
| 75 | br i1 undef, label %.loopexit, label %9 |
| 76 | |
| 77 | ; <label>:9 ; preds = %8 |
| 78 | %10 = and i32 %b8, 1 |
| 79 | %11 = shl nuw nsw i32 %10, 3 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 80 | %12 = getelementptr inbounds %struct.Slice, %struct.Slice* null, i32 0, i32 9 |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 81 | br i1 undef, label %.preheader, label %.preheader11 |
| 82 | |
| 83 | .preheader11: ; preds = %21, %9 |
| 84 | %k.014 = phi i32 [ %27, %21 ], [ 0, %9 ] |
| 85 | %coef_ctr.013 = phi i32 [ %23, %21 ], [ -1, %9 ] |
| 86 | br i1 false, label %13, label %14 |
| 87 | |
| 88 | ; <label>:13 ; preds = %.preheader11 |
| 89 | br label %15 |
| 90 | |
| 91 | ; <label>:14 ; preds = %.preheader11 |
| 92 | br label %15 |
| 93 | |
| 94 | ; <label>:15 ; preds = %14, %13 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 95 | %16 = getelementptr inbounds [0 x [20 x i32]], [0 x [20 x i32]]* @assignSE2partition, i32 0, i32 %1, i32 undef |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 96 | %17 = load i32, i32* %16, align 4 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 97 | %18 = getelementptr inbounds %struct.datapartition, %struct.datapartition* null, i32 %17, i32 2 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 98 | %19 = load i32 (%struct.syntaxelement*, %struct.img_par*, %struct.datapartition*)*, i32 (%struct.syntaxelement*, %struct.img_par*, %struct.datapartition*)** %18, align 4 |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 99 | %20 = call i32 %19(%struct.syntaxelement* undef, %struct.img_par* %img, %struct.datapartition* undef) |
| 100 | br i1 false, label %.loopexit, label %21 |
| 101 | |
| 102 | ; <label>:21 ; preds = %15 |
| 103 | %22 = add i32 %coef_ctr.013, 1 |
| 104 | %23 = add i32 %22, 0 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 105 | %24 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i32 %23, i32 0 |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 106 | %25 = add nsw i32 0, %11 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 107 | %26 = getelementptr inbounds %struct.img_par, %struct.img_par* %img, i32 0, i32 27, i32 undef, i32 %25 |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 108 | store i32 0, i32* %26, align 4 |
| 109 | %27 = add nsw i32 %k.014, 1 |
| 110 | %28 = icmp slt i32 %27, 65 |
| 111 | br i1 %28, label %.preheader11, label %.loopexit |
| 112 | |
| 113 | .preheader: ; preds = %36, %9 |
| 114 | %k.110 = phi i32 [ %45, %36 ], [ 0, %9 ] |
| 115 | %coef_ctr.29 = phi i32 [ %39, %36 ], [ -1, %9 ] |
| 116 | br i1 false, label %29, label %30 |
| 117 | |
| 118 | ; <label>:29 ; preds = %.preheader |
| 119 | br label %31 |
| 120 | |
| 121 | ; <label>:30 ; preds = %.preheader |
| 122 | br label %31 |
| 123 | |
| 124 | ; <label>:31 ; preds = %30, %29 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 125 | %32 = getelementptr inbounds [0 x [20 x i32]], [0 x [20 x i32]]* @assignSE2partition, i32 0, i32 %1, i32 undef |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 126 | %33 = load i32, i32* %32, align 4 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 127 | %34 = getelementptr inbounds %struct.datapartition, %struct.datapartition* null, i32 %33 |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 128 | %35 = call i32 undef(%struct.syntaxelement* undef, %struct.img_par* %img, %struct.datapartition* %34) |
| 129 | br i1 false, label %.loopexit, label %36 |
| 130 | |
| 131 | ; <label>:36 ; preds = %31 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 132 | %37 = load i32, i32* undef, align 4 |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 133 | %38 = add i32 %coef_ctr.29, 1 |
| 134 | %39 = add i32 %38, %37 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 135 | %40 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i32 %39, i32 0 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 136 | %41 = load i8, i8* %40, align 1 |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 137 | %42 = zext i8 %41 to i32 |
| 138 | %43 = add nsw i32 %42, %11 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 139 | %44 = getelementptr inbounds %struct.img_par, %struct.img_par* %img, i32 0, i32 27, i32 undef, i32 %43 |
Sasa Stankovic | 56c12e6 | 2014-06-05 13:42:48 +0000 | [diff] [blame] | 140 | store i32 0, i32* %44, align 4 |
| 141 | %45 = add nsw i32 %k.110, 1 |
| 142 | %46 = icmp slt i32 %45, 65 |
| 143 | br i1 %46, label %.preheader, label %.loopexit |
| 144 | |
| 145 | .loopexit: ; preds = %36, %31, %21, %15, %8 |
| 146 | ret void |
| 147 | } |