| OLD | NEW |
| 1 ; This is a smoke test for reordering pooled constants. | 1 ; This is a smoke test for reordering pooled constants. |
| 2 ; This option is only implemented for target X8632 for now. | 2 ; This option is only implemented for target X8632 for now. |
| 3 | 3 |
| 4 ; RUN: %p2i --assemble --disassemble --filetype=obj --dis-flags=-s \ | 4 ; RUN: %p2i --assemble --disassemble --filetype=obj --dis-flags=-s \ |
| 5 ; RUN: --target x8632 -i %s --args -sz-seed=1 -O2 -reorder-pooled-constants \ | 5 ; RUN: --target x8632 -i %s --args -sz-seed=1 -O2 -reorder-pooled-constants \ |
| 6 ; RUN: | FileCheck %s --check-prefix=X86O2 | 6 ; RUN: | FileCheck %s --check-prefix=X86 |
| 7 | 7 |
| 8 ; RUN: %p2i --assemble --disassemble --filetype=obj --dis-flags=-s \ | 8 ; RUN: %p2i --assemble --disassemble --filetype=obj --dis-flags=-s \ |
| 9 ; RUN: --target x8632 -i %s --args -sz-seed=1 -Om1 -reorder-pooled-constants \ | 9 ; RUN: --target x8632 -i %s --args -sz-seed=1 -Om1 -reorder-pooled-constants \ |
| 10 ; RUN: | FileCheck %s --check-prefix=X86OM1 | 10 ; RUN: | FileCheck %s --check-prefix=X86 |
| 11 | 11 |
| 12 @__init_array_start = internal constant [0 x i8] zeroinitializer, align 4 | 12 @__init_array_start = internal constant [0 x i8] zeroinitializer, align 4 |
| 13 @__fini_array_start = internal constant [0 x i8] zeroinitializer, align 4 | 13 @__fini_array_start = internal constant [0 x i8] zeroinitializer, align 4 |
| 14 @__tls_template_start = internal constant [0 x i8] zeroinitializer, align 8 | 14 @__tls_template_start = internal constant [0 x i8] zeroinitializer, align 8 |
| 15 @__tls_template_alignment = internal constant [4 x i8] c"\01\00\00\00", align 4 | 15 @__tls_template_alignment = internal constant [4 x i8] c"\01\00\00\00", align 4 |
| 16 | 16 |
| 17 define internal float @FpLookup1(i32 %Arg) { | 17 define internal float @FpLookup1(i32 %Arg) { |
| 18 entry: | 18 entry: |
| 19 switch i32 %Arg, label %return [ | 19 switch i32 %Arg, label %return [ |
| 20 i32 0, label %sw.bb | 20 i32 0, label %sw.bb |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 %conv67 = fpext float %call66 to double | 526 %conv67 = fpext float %call66 to double |
| 527 %add68 = fadd double %conv67, 0xFFF8000000000000 | 527 %add68 = fadd double %conv67, 0xFFF8000000000000 |
| 528 br label %return | 528 br label %return |
| 529 | 529 |
| 530 return: ; preds = %entry, %sw.bb65, %s
w.bb61, %sw.bb57, %sw.bb53, %sw.bb49, %sw.bb45, %sw.bb41, %sw.bb37, %sw.bb33, %s
w.bb29, %sw.bb25, %sw.bb21, %sw.bb17, %sw.bb13, %sw.bb9, %sw.bb5, %sw.bb1, %sw.b
b | 530 return: ; preds = %entry, %sw.bb65, %s
w.bb61, %sw.bb57, %sw.bb53, %sw.bb49, %sw.bb45, %sw.bb41, %sw.bb37, %sw.bb33, %s
w.bb29, %sw.bb25, %sw.bb21, %sw.bb17, %sw.bb13, %sw.bb9, %sw.bb5, %sw.bb1, %sw.b
b |
| 531 %retval.0 = phi double [ %add68, %sw.bb65 ], [ %add64, %sw.bb61 ], [ %add60, %
sw.bb57 ], [ %add56, %sw.bb53 ], [ %add52, %sw.bb49 ], [ %conv48, %sw.bb45 ], [
%conv44, %sw.bb41 ], [ %conv40, %sw.bb37 ], [ %conv36, %sw.bb33 ], [ %add32, %sw
.bb29 ], [ %add28, %sw.bb25 ], [ %add24, %sw.bb21 ], [ %add20, %sw.bb17 ], [ %ad
d16, %sw.bb13 ], [ %conv12, %sw.bb9 ], [ %conv8, %sw.bb5 ], [ %conv4, %sw.bb1 ],
[ %conv, %sw.bb ], [ 0.000000e+00, %entry ] | 531 %retval.0 = phi double [ %add68, %sw.bb65 ], [ %add64, %sw.bb61 ], [ %add60, %
sw.bb57 ], [ %add56, %sw.bb53 ], [ %add52, %sw.bb49 ], [ %conv48, %sw.bb45 ], [
%conv44, %sw.bb41 ], [ %conv40, %sw.bb37 ], [ %conv36, %sw.bb33 ], [ %add32, %sw
.bb29 ], [ %add28, %sw.bb25 ], [ %add24, %sw.bb21 ], [ %add20, %sw.bb17 ], [ %ad
d16, %sw.bb13 ], [ %conv12, %sw.bb9 ], [ %conv8, %sw.bb5 ], [ %conv4, %sw.bb1 ],
[ %conv, %sw.bb ], [ 0.000000e+00, %entry ] |
| 532 ret double %retval.0 | 532 ret double %retval.0 |
| 533 } | 533 } |
| 534 | 534 |
| 535 ; Make sure the constants in pools are shuffled. | 535 ; Make sure the constants in pools are shuffled. |
| 536 ; TODO(qining, stichnot): Unify the checkers for Om1 and O2 optimization levels. | |
| 537 ; Om1 and O2 result into different sizes of i32 constant pools. | |
| 538 ; Because the shuffling routine of constant pools is applied to integer | |
| 539 ; constant pools first, the random number used for shuffling float and double | |
| 540 ; constant pools will be different for Om1 and O2, so is the order of the pooled | |
| 541 ; float and double constants. The source of this difference may includes: stack | |
| 542 ; frame size, strength reduction, etc. | |
| 543 | 536 |
| 544 ; Check for float pool | 537 ; Check for float pool |
| 545 ; X86O2-LABEL: .rodata.cst4 | 538 ; X86-LABEL: .rodata.cst4 |
| 546 ; X86O2: 00000040 0000c0ff 00000041 00000000 | 539 ; X86: 00000041 0000c0ff 0000803f 00008040 |
| 547 ; X86O2: 0000003f 0000803f 00008040 0000c07f | 540 ; X86: 0000c07f 00000000 0000003f 0000803e |
| 548 ; X86O2: 0000803e | 541 ; X86: 00000040 |
| 549 | 542 |
| 550 ; Check for double pool | 543 ; Check for double pool |
| 551 ; X86O2-LABEL: .rodata.cst8 | 544 ; X86-LABEL: .rodata.cst8 |
| 552 ; X86O2: 55555555 5555d53f 00000000 0000f8ff | 545 ; X86: 00000000 0000f8ff 00000000 0000f87f |
| 553 ; X86O2: 00000000 0000f87f 00000000 0000e03f | 546 ; X86: 00000000 0000e03f 00000000 00000000 |
| 554 ; X86O2: 00000000 0000d03f 00000000 00000000 | 547 ; X86: 55555555 5555d53f 00000000 0000d03f |
| 555 | 548 |
| 556 ; X86O2-LABEL: .text | 549 ; X86-LABEL: .text |
| 557 | |
| 558 ; Check for float pool | |
| 559 ; X86OM1-LABEL: .rodata.cst4 | |
| 560 ; X86OM1: 0000803f 0000003f 00000040 0000c0ff | |
| 561 ; X86OM1: 00000000 00008040 0000c07f 0000803e | |
| 562 ; X86OM1: 00000041 | |
| 563 | |
| 564 ; Check for double pool | |
| 565 ; X86OM1-LABEL: .rodata.cst8 | |
| 566 ; X86OM1: 00000000 0000e03f 00000000 0000f87f | |
| 567 ; X86OM1: 00000000 0000f8ff 00000000 0000d03f | |
| 568 ; X86OM1: 00000000 00000000 55555555 5555d53f | |
| 569 | |
| 570 ; X86OM1-LABEL: .text | |
| OLD | NEW |