| OLD | NEW |
| (Empty) | |
| 1 ; This is a smoke test of random number generator. |
| 2 ; The random number generators for different randomization passes should be |
| 3 ; decoupled. The random number used in one randomization pass should not be |
| 4 ; influenced by the existence of other randomization passes. |
| 5 |
| 6 ; REQUIRES: allow_dump, target_X8632 |
| 7 |
| 8 ; Command for checking constant blinding (Need to turn off nop-insertion) |
| 9 ; RUN: %p2i --target x8632 -i %s --filetype=obj --disassemble --args -O2 \ |
| 10 ; RUN: -sz-seed=1 -randomize-pool-immediates=randomize \ |
| 11 ; RUN: -randomize-pool-threshold=0x1 \ |
| 12 ; RUN: -reorder-global-variables \ |
| 13 ; RUN: -reorder-basic-blocks \ |
| 14 ; RUN: -reorder-functions \ |
| 15 ; RUN: -randomize-regalloc \ |
| 16 ; RUN: -nop-insertion=0 \ |
| 17 ; RUN: -reorder-pooled-constants \ |
| 18 ; RUN: | FileCheck %s --check-prefix=BLINDINGO2 |
| 19 |
| 20 ; Command for checking global variable reordering |
| 21 ; RUN: %p2i --target x8632 -i %s \ |
| 22 ; RUN: --filetype=obj --disassemble --dis-flags=-rD \ |
| 23 ; RUN: --args -O2 -sz-seed=1 \ |
| 24 ; RUN: -randomize-pool-immediates=randomize \ |
| 25 ; RUN: -randomize-pool-threshold=0x1 \ |
| 26 ; RUN: -reorder-global-variables \ |
| 27 ; RUN: -reorder-basic-blocks \ |
| 28 ; RUN: -reorder-functions \ |
| 29 ; RUN: -randomize-regalloc \ |
| 30 ; RUN: -nop-insertion \ |
| 31 ; RUN: -reorder-pooled-constants \ |
| 32 ; RUN: | FileCheck %s --check-prefix=GLOBALVARS |
| 33 |
| 34 ; Command for checking basic block reordering |
| 35 ; RUN: %p2i --target x8632 -i %s --filetype=asm --args -O2 -sz-seed=1\ |
| 36 ; RUN: -randomize-pool-immediates=randomize \ |
| 37 ; RUN: -randomize-pool-threshold=0x1 \ |
| 38 ; RUN: -reorder-global-variables \ |
| 39 ; RUN: -reorder-basic-blocks \ |
| 40 ; RUN: -reorder-functions \ |
| 41 ; RUN: -randomize-regalloc \ |
| 42 ; RUN: -nop-insertion \ |
| 43 ; RUN: -reorder-pooled-constants \ |
| 44 ; RUN: | FileCheck %s --check-prefix=BBREORDERING |
| 45 |
| 46 ; Command for checking function reordering |
| 47 ; RUN: %p2i --target x8632 -i %s --filetype=obj --disassemble --args -O2 \ |
| 48 ; RUN: -sz-seed=1 -randomize-pool-immediates=randomize \ |
| 49 ; RUN: -randomize-pool-threshold=0x1 \ |
| 50 ; RUN: -reorder-global-variables \ |
| 51 ; RUN: -reorder-basic-blocks \ |
| 52 ; RUN: -reorder-functions \ |
| 53 ; RUN: -randomize-regalloc \ |
| 54 ; RUN: -nop-insertion \ |
| 55 ; RUN: -reorder-pooled-constants \ |
| 56 ; RUN: | FileCheck %s --check-prefix=FUNCREORDERING |
| 57 |
| 58 ; Command for checking regalloc randomization |
| 59 ; RUN: %p2i --target x8632 -i %s --filetype=obj --disassemble --args -O2 \ |
| 60 ; RUN: -sz-seed=1 -randomize-pool-immediates=randomize \ |
| 61 ; RUN: -randomize-pool-threshold=0x1 \ |
| 62 ; RUN: -reorder-global-variables \ |
| 63 ; RUN: -reorder-basic-blocks \ |
| 64 ; RUN: -reorder-functions \ |
| 65 ; RUN: -randomize-regalloc \ |
| 66 ; RUN: -nop-insertion \ |
| 67 ; RUN: -reorder-pooled-constants \ |
| 68 ; RUN: | FileCheck %s --check-prefix=REGALLOC |
| 69 |
| 70 ; Command for checking nop insertion (Need to turn off randomize-regalloc) |
| 71 ; RUN: %p2i --target x8632 -i %s --filetype=asm --args \ |
| 72 ; RUN: -sz-seed=1 -randomize-pool-immediates=randomize \ |
| 73 ; RUN: -reorder-global-variables \ |
| 74 ; RUN: -reorder-basic-blocks \ |
| 75 ; RUN: -reorder-functions \ |
| 76 ; RUN: -randomize-regalloc=0 \ |
| 77 ; RUN: -nop-insertion -nop-insertion-percentage=50\ |
| 78 ; RUN: -reorder-pooled-constants \ |
| 79 ; RUN: | FileCheck %s --check-prefix=NOPINSERTION |
| 80 |
| 81 ; Command for checking pooled constants reordering |
| 82 ; RUN: %p2i --target x8632 -i %s --filetype=obj --disassemble --dis-flags=-s \ |
| 83 ; RUN: --args -O2 -sz-seed=1 \ |
| 84 ; RUN: -randomize-pool-immediates=randomize \ |
| 85 ; RUN: -randomize-pool-threshold=0x1 \ |
| 86 ; RUN: -reorder-global-variables \ |
| 87 ; RUN: -reorder-basic-blocks \ |
| 88 ; RUN: -reorder-functions \ |
| 89 ; RUN: -randomize-regalloc \ |
| 90 ; RUN: -nop-insertion \ |
| 91 ; RUN: -reorder-pooled-constants \ |
| 92 ; RUN: | FileCheck %s --check-prefix=POOLEDCONSTANTS |
| 93 |
| 94 |
| 95 ; Global variables copied from reorder-global-variables.ll |
| 96 @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 |
| 97 @PrimitiveInitConst = internal constant [4 x i8] c"\0D\00\00\00", align 4 |
| 98 @ArrayInit = internal global [20 x i8] c"\0A\00\00\00\14\00\00\00\1E\00\00\00(\0
0\00\002\00\00\00", align 4 |
| 99 @ArrayInitPartial = internal global [40 x i8] c"<\00\00\00F\00\00\00P\00\00\00Z\
00\00\00d\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00",
align 4 |
| 100 @PrimitiveInitStatic = internal global [4 x i8] zeroinitializer, align 4 |
| 101 @PrimitiveUninit = internal global [4 x i8] zeroinitializer, align 4 |
| 102 @ArrayUninit = internal global [20 x i8] zeroinitializer, align 4 |
| 103 @ArrayUninitConstDouble = internal constant [200 x i8] zeroinitializer, align 8 |
| 104 @ArrayUninitConstInt = internal constant [20 x i8] zeroinitializer, align 4 |
| 105 |
| 106 |
| 107 define <4 x i32> @func1(<4 x i32> %a, <4 x i32> %b) { |
| 108 entry: |
| 109 %res = mul <4 x i32> %a, %b |
| 110 ret <4 x i32> %res |
| 111 |
| 112 ; NOPINSERTION-LABEL: func1 |
| 113 ; NOPINSERTION: nop # variant = 1 |
| 114 ; NOPINSERTION: subl $60, %esp |
| 115 ; NOPINSERTION: nop # variant = 3 |
| 116 ; NOPINSERTION: movups %xmm0, 32(%esp) |
| 117 ; NOPINSERTION: movups %xmm1, 16(%esp) |
| 118 ; NOPINSERTION: movups 32(%esp), %xmm0 |
| 119 ; NOPINSERTION: nop # variant = 1 |
| 120 ; NOPINSERTION: pshufd $49, 32(%esp), %xmm1 |
| 121 ; NOPINSERTION: nop # variant = 4 |
| 122 ; NOPINSERTION: pshufd $49, 16(%esp), %xmm2 |
| 123 ; NOPINSERTION: nop # variant = 1 |
| 124 ; NOPINSERTION: pmuludq 16(%esp), %xmm0 |
| 125 ; NOPINSERTION: pmuludq %xmm2, %xmm1 |
| 126 ; NOPINSERTION: nop # variant = 0 |
| 127 ; NOPINSERTION: shufps $136, %xmm1, %xmm0 |
| 128 ; NOPINSERTION: nop # variant = 3 |
| 129 ; NOPINSERTION: pshufd $216, %xmm0, %xmm0 |
| 130 ; NOPINSERTION: nop # variant = 1 |
| 131 ; NOPINSERTION: movups %xmm0, (%esp) |
| 132 ; NOPINSERTION: movups (%esp), %xmm0 |
| 133 ; NOPINSERTION: addl $60, %esp |
| 134 ; NOPINSERTION: ret |
| 135 } |
| 136 |
| 137 |
| 138 |
| 139 define float @func2(float* %arg) { |
| 140 entry: |
| 141 %arg.int = ptrtoint float* %arg to i32 |
| 142 %addr.int = add i32 %arg.int, 200000 |
| 143 %addr.ptr = inttoptr i32 %addr.int to float* |
| 144 %addr.load = load float, float* %addr.ptr, align 4 |
| 145 ret float %addr.load |
| 146 |
| 147 ; BLINDINGO2-LABEL: func2 |
| 148 ; BLINDINGO2: lea [[REG:e[a-z]*]],{{[[]}}{{e[a-z]*}}+0x32c814{{[]]}} |
| 149 } |
| 150 |
| 151 define float @func3(i32 %arg, float %input) { |
| 152 entry: |
| 153 switch i32 %arg, label %return [ |
| 154 i32 0, label %sw.bb |
| 155 i32 1, label %sw.bb1 |
| 156 i32 2, label %sw.bb2 |
| 157 i32 3, label %sw.bb3 |
| 158 i32 4, label %sw.bb4 |
| 159 ] |
| 160 |
| 161 sw.bb: |
| 162 %rbb = fadd float %input, 1.000000e+00 |
| 163 br label %return |
| 164 |
| 165 sw.bb1: |
| 166 %rbb1 = fadd float %input, 2.000000e+00 |
| 167 br label %return |
| 168 |
| 169 sw.bb2: |
| 170 %rbb2 = fadd float %input, 4.000000e+00 |
| 171 br label %return |
| 172 |
| 173 sw.bb3: |
| 174 %rbb3 = fadd float %input, 5.000000e-01 |
| 175 br label %return |
| 176 |
| 177 sw.bb4: |
| 178 %rbb4 = fadd float %input, 2.500000e-01 |
| 179 br label %return |
| 180 |
| 181 return: |
| 182 %retval.0 = phi float [ %rbb, %sw.bb ], [ %rbb1, %sw.bb1 ], [ %rbb2, %sw.bb2 ]
, [ %rbb3, %sw.bb3 ], [ %rbb4, %sw.bb4], [ 0.000000e+00, %entry ] |
| 183 ret float %retval.0 |
| 184 } |
| 185 |
| 186 define <4 x i32> @func4(<4 x i32> %a, <4 x i32> %b) { |
| 187 entry: |
| 188 %res = mul <4 x i32> %a, %b |
| 189 ret <4 x i32> %res |
| 190 |
| 191 ; REGALLOC-LABEL: func4 |
| 192 ; REGALLOC: movups xmm3,xmm0 |
| 193 ; REGALLOC-NEXT: pshufd xmm0,xmm0,0x31 |
| 194 ; REGALLOC-NEXT: pshufd xmm5,xmm1,0x31 |
| 195 ; REGALLOC-NEXT: pmuludq xmm3,xmm1 |
| 196 ; REGALLOC-NEXT: pmuludq xmm0,xmm5 |
| 197 ; REGALLOC-NEXT: shufps xmm3,xmm0,0x88 |
| 198 ; REGALLOC-NEXT: pshufd xmm3,xmm3,0xd8 |
| 199 ; REGALLOC-NEXT: movups xmm0,xmm3 |
| 200 ; REGALLOC-NEXT: ret |
| 201 } |
| 202 |
| 203 define void @func5(i32 %foo, i32 %bar) { |
| 204 entry: |
| 205 %r1 = icmp eq i32 %foo, %bar |
| 206 br i1 %r1, label %BB1, label %BB2 |
| 207 BB1: |
| 208 %r2 = icmp sgt i32 %foo, %bar |
| 209 br i1 %r2, label %BB3, label %BB4 |
| 210 BB2: |
| 211 %r3 = icmp slt i32 %foo, %bar |
| 212 br i1 %r3, label %BB3, label %BB4 |
| 213 BB3: |
| 214 ret void |
| 215 BB4: |
| 216 ret void |
| 217 |
| 218 ; BBREORDERING-LABEL: func5: |
| 219 ; BBREORDERING: .Lfunc5$entry: |
| 220 ; BBREORDERING: .Lfunc5$BB1: |
| 221 ; BBREORDERING: .Lfunc5$BB2: |
| 222 ; BBREORDERING: .Lfunc5$BB4: |
| 223 ; BBREORDERING: .Lfunc5$BB3 |
| 224 } |
| 225 |
| 226 define i32 @func6(i32 %arg) { |
| 227 entry: |
| 228 %res = add i32 200000, %arg |
| 229 ret i32 %res |
| 230 |
| 231 ; BLINDINGO2-LABEL: func6 |
| 232 ; BLINDINGO2: mov [[REG:e[a-z]*]],0xb178f |
| 233 ; BLINDINGO2-NEXT: lea [[REG]],{{[[]}}[[REG]]-0x80a4f{{[]]}} |
| 234 } |
| 235 |
| 236 ; Check for function reordering |
| 237 ; FUNCREORDERING-LABEL: func1 |
| 238 ; FUNCREORDERING-LABEL: func4 |
| 239 ; FUNCREORDERING-LABEL: func5 |
| 240 ; FUNCREORDERING-LABEL: func2 |
| 241 ; FUNCREORDERING-LABEL: func6 |
| 242 ; FUNCREORDERING-LABEL: func3 |
| 243 |
| 244 ; Check for global variable reordering |
| 245 ; GLOBALVARS-LABEL: ArrayInit |
| 246 ; GLOBALVARS-LABEL: PrimitiveInit |
| 247 ; GLOBALVARS-LABEL: ArrayInitPartial |
| 248 ; GLOBALVARS-LABEL: PrimitiveUninit |
| 249 ; GLOBALVARS-LABEL: ArrayUninit |
| 250 ; GLOBALVARS-LABEL: PrimitiveInitStatic |
| 251 ; GLOBALVARS-LABEL: ArrayUninitConstDouble |
| 252 ; GLOBALVARS-LABEL: ArrayUninitConstInt |
| 253 ; GLOBALVARS-LABEL: PrimitiveInitConst |
| 254 |
| 255 ; Check for pooled constant reordering |
| 256 ; POOLEDCONSTANTS-LABEL: .rodata.cst4 |
| 257 ; POOLEDCONSTANTS: 0000803e 0000803f 00000000 0000003f |
| 258 ; POOLEDCONSTANTS: 00008040 00000040 |
| OLD | NEW |