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