Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 ; Simple test of the select instruction. The CHECK lines are only | 1 ; Simple test of the select instruction. The CHECK lines are only |
| 2 ; checking for basic instruction patterns that should be present | 2 ; checking for basic instruction patterns that should be present |
| 3 ; regardless of the optimization level, so there are no special OPTM1 | 3 ; regardless of the optimization level, so there are no special OPTM1 |
| 4 ; match lines. | 4 ; match lines. |
| 5 | 5 |
| 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 7 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \ | 7 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \ |
| 8 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 8 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
| 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 10 ; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \ | 10 ; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \ |
| 11 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 11 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
| 12 | 12 |
| 13 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 13 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
| 14 ; RUN: --command %p2i --filetype=asm --assemble \ | 14 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 15 ; RUN: --disassemble --target arm32 -i %s --args -O2 \ | 15 ; RUN: --disassemble --target arm32 -i %s --args -O2 \ |
| 16 ; RUN: -allow-externally-defined-symbols \ | 16 ; RUN: -allow-externally-defined-symbols \ |
| 17 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 17 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
| 18 ; RUN: --command FileCheck --check-prefix ARM32 --check-prefix ARM32-O2 %s | 18 ; RUN: --command FileCheck --check-prefix ARM32 --check-prefix ARM32-O2 %s |
| 19 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 19 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
| 20 ; RUN: --command %p2i --filetype=asm --assemble \ | 20 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 21 ; RUN: --disassemble --target arm32 -i %s --args -Om1 \ | 21 ; RUN: --disassemble --target arm32 -i %s --args -Om1 \ |
| 22 ; RUN: -allow-externally-defined-symbols \ | 22 ; RUN: -allow-externally-defined-symbols \ |
| 23 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 23 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
| 24 ; RUN: --command FileCheck --check-prefix ARM32 --check-prefix ARM32-OM1 %s | 24 ; RUN: --command FileCheck --check-prefix ARM32 --check-prefix ARM32-OM1 %s |
| 25 | 25 |
| 26 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ | |
| 27 ; RUN: --command %p2i --filetype=asm --assemble \ | |
| 28 ; RUN: --disassemble --target mips32 -i %s --args -Om1 \ | |
| 29 ; RUN: -allow-externally-defined-symbols -skip-unimplemented \ | |
| 30 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ | |
| 31 ; RUN: --command FileCheck --check-prefix MIPS32 %s | |
| 32 | |
| 33 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ | |
| 34 ; RUN: --command %p2i --filetype=asm --assemble \ | |
| 35 ; RUN: --disassemble --target mips32 -i %s --args -O2 \ | |
| 36 ; RUN: -allow-externally-defined-symbols -skip-unimplemented \ | |
| 37 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ | |
| 38 ; RUN: --command FileCheck --check-prefix MIPS32-O2 %s | |
|
Jim Stichnoth
2016/09/14 06:02:18
It looks like the CHECK patterns are identical for
obucinac
2016/09/14 12:39:02
Done.
| |
| 39 | |
| 26 define internal void @testSelect(i32 %a, i32 %b) { | 40 define internal void @testSelect(i32 %a, i32 %b) { |
| 27 entry: | 41 entry: |
| 28 %cmp = icmp slt i32 %a, %b | 42 %cmp = icmp slt i32 %a, %b |
| 29 %cond = select i1 %cmp, i32 %a, i32 %b | 43 %cond = select i1 %cmp, i32 %a, i32 %b |
| 30 tail call void @useInt(i32 %cond) | 44 tail call void @useInt(i32 %cond) |
| 31 %cmp1 = icmp sgt i32 %a, %b | 45 %cmp1 = icmp sgt i32 %a, %b |
| 32 %cond2 = select i1 %cmp1, i32 10, i32 20 | 46 %cond2 = select i1 %cmp1, i32 10, i32 20 |
| 33 tail call void @useInt(i32 %cond2) | 47 tail call void @useInt(i32 %cond2) |
| 34 ; Create "fake" uses of %cmp and %cmp1 to prevent O2 bool folding. | 48 ; Create "fake" uses of %cmp and %cmp1 to prevent O2 bool folding. |
| 35 %d1 = zext i1 %cmp to i32 | 49 %d1 = zext i1 %cmp to i32 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 54 ; ARM32: bl {{.*}} useInt | 68 ; ARM32: bl {{.*}} useInt |
| 55 ; ARM32-Om1: mov {{.*}}, #20 | 69 ; ARM32-Om1: mov {{.*}}, #20 |
| 56 ; ARM32-O2: mov [[REG:r[0-9]+]], #20 | 70 ; ARM32-O2: mov [[REG:r[0-9]+]], #20 |
| 57 ; ARM32: tst | 71 ; ARM32: tst |
| 58 ; ARM32-Om1: movne {{.*}}, #10 | 72 ; ARM32-Om1: movne {{.*}}, #10 |
| 59 ; ARM32-O2: movne [[REG]], #10 | 73 ; ARM32-O2: movne [[REG]], #10 |
| 60 ; ARM32: bl {{.*}} useInt | 74 ; ARM32: bl {{.*}} useInt |
| 61 ; ARM32: bl {{.*}} useInt | 75 ; ARM32: bl {{.*}} useInt |
| 62 ; ARM32: bl {{.*}} useInt | 76 ; ARM32: bl {{.*}} useInt |
| 63 ; ARM32: bx lr | 77 ; ARM32: bx lr |
| 78 ; MIPS32-LABEL: testSelect | |
| 79 ; MIPS32: slt {{.*}} | |
| 80 ; MIPS32: movn {{.*}} | |
| 81 ; MIPS32: addiu {{.*}} | |
| 82 ; MIPS32-O2-LABEL: testSelect | |
| 83 ; MIPS32-O2: slt {{.*}} | |
| 84 ; MIPS32-O2: movn {{.*}} | |
| 85 ; MIPS32-O2: move {{.*}} | |
| 64 | 86 |
| 65 ; Check for valid addressing mode in the cmp instruction when the | 87 ; Check for valid addressing mode in the cmp instruction when the |
| 66 ; operand is an immediate. | 88 ; operand is an immediate. |
| 67 define internal i32 @testSelectImm32(i32 %a, i32 %b) { | 89 define internal i32 @testSelectImm32(i32 %a, i32 %b) { |
| 68 entry: | 90 entry: |
| 69 %cond = select i1 false, i32 %a, i32 %b | 91 %cond = select i1 false, i32 %a, i32 %b |
| 70 ret i32 %cond | 92 ret i32 %cond |
| 71 } | 93 } |
| 72 ; CHECK-LABEL: testSelectImm32 | 94 ; CHECK-LABEL: testSelectImm32 |
| 73 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, | 95 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, |
| 74 ; ARM32-LABEL: testSelectImm32 | 96 ; ARM32-LABEL: testSelectImm32 |
| 75 ; ARM32-NOT: cmp #{{.*}}, | 97 ; ARM32-NOT: cmp #{{.*}}, |
| 98 ; MIPS32-LABEL: testSelectImm32 | |
| 99 ; MIPS32: movn {{.*}} | |
| 100 ; MIPS32: addiu {{.*}} | |
| 101 ; MIPS32-O2-LABEL: testSelect | |
|
Jim Stichnoth
2016/09/14 06:02:17
testSelectImm32
obucinac
2016/09/14 12:39:02
Done.
| |
| 102 ; MIPS32-O2: movn {{.*}} | |
| 103 ; MIPS32-O2: move {{.*}} | |
| 76 | 104 |
| 77 ; Check for valid addressing mode in the cmp instruction when the | 105 ; Check for valid addressing mode in the cmp instruction when the |
| 78 ; operand is an immediate. There is a different x86-32 lowering | 106 ; operand is an immediate. There is a different x86-32 lowering |
| 79 ; sequence for 64-bit operands. | 107 ; sequence for 64-bit operands. |
| 80 define internal i64 @testSelectImm64(i64 %a, i64 %b) { | 108 define internal i64 @testSelectImm64(i64 %a, i64 %b) { |
| 81 entry: | 109 entry: |
| 82 %cond = select i1 true, i64 %a, i64 %b | 110 %cond = select i1 true, i64 %a, i64 %b |
| 83 ret i64 %cond | 111 ret i64 %cond |
| 84 } | 112 } |
| 85 ; CHECK-LABEL: testSelectImm64 | 113 ; CHECK-LABEL: testSelectImm64 |
| 86 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, | 114 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, |
| 87 ; ARM32-LABEL: testSelectImm64 | 115 ; ARM32-LABEL: testSelectImm64 |
| 88 ; ARM32-NOT: cmp #{{.*}}, | 116 ; ARM32-NOT: cmp #{{.*}}, |
| 117 ; MIPS32-LABEL: testSelectImm64 | |
| 118 ; MIPS32-O2-LABEL: testSelectImm64 | |
| OLD | NEW |