| OLD | NEW |
| 1 ; This tests the advanced lowering of switch statements. The advanced lowering | 1 ; This tests the advanced lowering of switch statements. The advanced lowering |
| 2 ; uses jump tables, range tests and binary search. | 2 ; uses jump tables, range tests and binary search. |
| 3 | 3 |
| 4 ; RUN: %p2i -i %s --target=x8632 --filetype=obj --disassemble --args -O2 \ | 4 ; RUN: %p2i -i %s --target=x8632 --filetype=obj --disassemble --args -O2 \ |
| 5 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X8632 | 5 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X8632 |
| 6 ; RUN: %p2i -i %s --target=x8664 --filetype=obj --disassemble --args -O2 \ | 6 ; RUN: %p2i -i %s --target=x8664 --filetype=obj --disassemble --args -O2 \ |
| 7 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X8664 | 7 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X8664 |
| 8 | 8 |
| 9 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ | 9 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ |
| 10 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \ | 10 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 ; Note: x86-32 may do "mov eax, [...]; jmp eax", whereas x86-64 may do | 48 ; Note: x86-32 may do "mov eax, [...]; jmp eax", whereas x86-64 may do |
| 49 ; "mov eax, [...]; jmp rax", so we assume the all characters except the first | 49 ; "mov eax, [...]; jmp rax", so we assume the all characters except the first |
| 50 ; one in the register name will match. | 50 ; one in the register name will match. |
| 51 | 51 |
| 52 ; MIPS32-LABEL: testJumpTable | 52 ; MIPS32-LABEL: testJumpTable |
| 53 ; MIPS32: move [[REG1:.*]],{{.*}} | 53 ; MIPS32: move [[REG1:.*]],{{.*}} |
| 54 ; MIPS32: li [[REG2:.*]],91 | 54 ; MIPS32: li [[REG2:.*]],91 |
| 55 ; MIPS32: beq [[REG1]],[[REG2]],6c <.LtestJumpTable$sw.default> | 55 ; MIPS32: beq [[REG1]],[[REG2]],6c <.LtestJumpTable$sw.default> |
| 56 ; MIPS32: nop | 56 ; MIPS32: nop |
| 57 ; MIPS32: li [[REG2:.*]],92 | 57 ; MIPS32: li [[REG2:.*]],92 |
| 58 ; MIPS32: » beq» [[REG1]],[[REG2]],7c <.LtestJumpTable$sw.bb1> | 58 ; MIPS32: » beq» [[REG1]],[[REG2]],78 <.LtestJumpTable$sw.bb1> |
| 59 ; MIPS32: nop | 59 ; MIPS32: nop |
| 60 ; MIPS32: li [[REG2:.*]],93 | 60 ; MIPS32: li [[REG2:.*]],93 |
| 61 ; MIPS32: beq [[REG1]],[[REG2]],6c <.LtestJumpTable$sw.default> | 61 ; MIPS32: beq [[REG1]],[[REG2]],6c <.LtestJumpTable$sw.default> |
| 62 ; MIPS32: nop | 62 ; MIPS32: nop |
| 63 ; MIPS32: li [[REG2:.*]],99 | 63 ; MIPS32: li [[REG2:.*]],99 |
| 64 ; MIPS32: » beq» [[REG1]],[[REG2]],7c <.LtestJumpTable$sw.bb1> | 64 ; MIPS32: » beq» [[REG1]],[[REG2]],78 <.LtestJumpTable$sw.bb1> |
| 65 ; MIPS32: nop | 65 ; MIPS32: nop |
| 66 ; MIPS32: li [[REG2:.*]],98 | 66 ; MIPS32: li [[REG2:.*]],98 |
| 67 ; MIPS32: beq [[REG1]],[[REG2]],6c <.LtestJumpTable$sw.default> | 67 ; MIPS32: beq [[REG1]],[[REG2]],6c <.LtestJumpTable$sw.default> |
| 68 ; MIPS32: nop | 68 ; MIPS32: nop |
| 69 ; MIPS32: li [[REG2:.*]],96 | 69 ; MIPS32: li [[REG2:.*]],96 |
| 70 ; MIPS32: » beq» [[REG1]],[[REG2]],7c <.LtestJumpTable$sw.bb1> | 70 ; MIPS32: » beq» [[REG1]],[[REG2]],78 <.LtestJumpTable$sw.bb1> |
| 71 ; MIPS32: nop | 71 ; MIPS32: nop |
| 72 ; MIPS32: li [[REG2:.*]],97 | 72 ; MIPS32: li [[REG2:.*]],97 |
| 73 ; MIPS32: beq [[REG1]],[[REG2]],60 <.LtestJumpTable$split_entry_sw.epi
log_0> | 73 ; MIPS32: beq [[REG1]],[[REG2]],60 <.LtestJumpTable$split_entry_sw.epi
log_0> |
| 74 ; MIPS32: nop | 74 ; MIPS32: nop |
| 75 ; MIPS32: b 6c <.LtestJumpTable$sw.default> | 75 ; MIPS32: b 6c <.LtestJumpTable$sw.default> |
| 76 ; MIPS32: nop | 76 ; MIPS32: nop |
| 77 | 77 |
| 78 ; Continuous ranges which map to the same target should be grouped and | 78 ; Continuous ranges which map to the same target should be grouped and |
| 79 ; efficiently tested. | 79 ; efficiently tested. |
| 80 define internal i32 @testRangeTest() { | 80 define internal i32 @testRangeTest() { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 br label %return | 312 br label %return |
| 313 | 313 |
| 314 return: | 314 return: |
| 315 %retval.0 = phi i32 [ 5, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, %
sw.bb1 ], [ 1, %entry ] | 315 %retval.0 = phi i32 [ 5, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, %
sw.bb1 ], [ 1, %entry ] |
| 316 ret i32 %retval.0 | 316 ret i32 %retval.0 |
| 317 } | 317 } |
| 318 | 318 |
| 319 ; TODO(ascull): this should generate a jump table. For now, just make sure it | 319 ; TODO(ascull): this should generate a jump table. For now, just make sure it |
| 320 ; doesn't crash the compiler. | 320 ; doesn't crash the compiler. |
| 321 ; CHECK-LABEL: testJumpTable64 | 321 ; CHECK-LABEL: testJumpTable64 |
| OLD | NEW |