| OLD | NEW |
| 1 ; This tries to be a comprehensive test of f32 and f64 call/return ops. | 1 ; This tries to be a comprehensive test of f32 and f64 call/return ops. |
| 2 ; The CHECK lines are only checking for basic instruction patterns | 2 ; The CHECK lines are only checking for basic instruction patterns |
| 3 ; that should be present regardless of the optimization level, so | 3 ; that should be present regardless of the optimization level, so |
| 4 ; there are no special OPTM1 match lines. | 4 ; there are no special OPTM1 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_MIPS32 --need=allow_dump \ |
| 14 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \ |
| 15 ; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \ |
| 16 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ |
| 17 ; RUN: --command FileCheck --check-prefix MIPS32 %s |
| 18 |
| 13 ; Can't test on ARM yet. Need to use several vpush {contiguous FP regs}, | 19 ; Can't test on ARM yet. Need to use several vpush {contiguous FP regs}, |
| 14 ; instead of push {any GPR list}. | 20 ; instead of push {any GPR list}. |
| 15 | 21 |
| 16 define internal i32 @doubleArgs(double %a, i32 %b, double %c) { | 22 define internal i32 @doubleArgs(double %a, i32 %b, double %c) { |
| 17 entry: | 23 entry: |
| 18 ret i32 %b | 24 ret i32 %b |
| 19 } | 25 } |
| 20 ; CHECK-LABEL: doubleArgs | 26 ; CHECK-LABEL: doubleArgs |
| 21 ; CHECK: mov eax,DWORD PTR [esp+0xc] | 27 ; CHECK: mov eax,DWORD PTR [esp+0xc] |
| 22 ; CHECK-NEXT: ret | 28 ; CHECK-NEXT: ret |
| 23 ; ARM32-LABEL: doubleArgs | 29 ; ARM32-LABEL: doubleArgs |
| 30 ; MIPS32-LABEL: doubleArgs |
| 31 ; MIPS32: move v0,a2 |
| 32 ; MIPS32: jr ra |
| 24 | 33 |
| 25 define internal i32 @floatArgs(float %a, i32 %b, float %c) { | 34 define internal i32 @floatArgs(float %a, i32 %b, float %c) { |
| 26 entry: | 35 entry: |
| 27 ret i32 %b | 36 ret i32 %b |
| 28 } | 37 } |
| 29 ; CHECK-LABEL: floatArgs | 38 ; CHECK-LABEL: floatArgs |
| 30 ; CHECK: mov eax,DWORD PTR [esp+0x8] | 39 ; CHECK: mov eax,DWORD PTR [esp+0x8] |
| 31 ; CHECK-NEXT: ret | 40 ; CHECK-NEXT: ret |
| 41 ; MIPS32-LABEL: floatArgs |
| 42 ; MIPS32: move v0,a1 |
| 43 ; MIPS32: jr ra |
| 32 | 44 |
| 33 define internal i32 @passFpArgs(float %a, double %b, float %c, double %d, float
%e, double %f) { | 45 define internal i32 @passFpArgs(float %a, double %b, float %c, double %d, float
%e, double %f) { |
| 34 entry: | 46 entry: |
| 35 %call = call i32 @ignoreFpArgsNoInline(float %a, i32 123, double %b) | 47 %call = call i32 @ignoreFpArgsNoInline(float %a, i32 123, double %b) |
| 36 %call1 = call i32 @ignoreFpArgsNoInline(float %c, i32 123, double %d) | 48 %call1 = call i32 @ignoreFpArgsNoInline(float %c, i32 123, double %d) |
| 37 %call2 = call i32 @ignoreFpArgsNoInline(float %e, i32 123, double %f) | 49 %call2 = call i32 @ignoreFpArgsNoInline(float %e, i32 123, double %f) |
| 38 %add = add i32 %call1, %call | 50 %add = add i32 %call1, %call |
| 39 %add3 = add i32 %add, %call2 | 51 %add3 = add i32 %add, %call2 |
| 40 ret i32 %add3 | 52 ret i32 %add3 |
| 41 } | 53 } |
| 42 ; CHECK-LABEL: passFpArgs | 54 ; CHECK-LABEL: passFpArgs |
| 43 ; CHECK: mov DWORD PTR [esp+0x4],0x7b | 55 ; CHECK: mov DWORD PTR [esp+0x4],0x7b |
| 44 ; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline | 56 ; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline |
| 45 ; CHECK: mov DWORD PTR [esp+0x4],0x7b | 57 ; CHECK: mov DWORD PTR [esp+0x4],0x7b |
| 46 ; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline | 58 ; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline |
| 47 ; CHECK: mov DWORD PTR [esp+0x4],0x7b | 59 ; CHECK: mov DWORD PTR [esp+0x4],0x7b |
| 48 ; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline | 60 ; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline |
| 61 ; MIPS32-LABEL: passFpArgs |
| 62 ; MIPS32: mfc1 a2,$f15 |
| 63 ; MIPS32: mfc1 a3,$f14 |
| 64 ; MIPS32: li a1,123 |
| 65 ; MIPS32: jal {{.*}} ignoreFpArgsNoInline |
| 66 ; MIPS32: mfc1 a2,$f23 |
| 67 ; MIPS32: mfc1 a3,$f22 |
| 68 ; MIPS32: li a1,123 |
| 69 ; MIPS32: jal {{.*}} ignoreFpArgsNoInline |
| 70 ; MIPS32: mfc1 a2,$f25 |
| 71 ; MIPS32: mfc1 a3,$f24 |
| 72 ; MIPS32: li a1,123 |
| 73 ; MIPS32: jal {{.*}} ignoreFpArgsNoInline |
| 49 | 74 |
| 50 declare i32 @ignoreFpArgsNoInline(float %x, i32 %y, double %z) | 75 declare i32 @ignoreFpArgsNoInline(float %x, i32 %y, double %z) |
| 51 | 76 |
| 52 define internal i32 @passFpConstArg(float %a, double %b) { | 77 define internal i32 @passFpConstArg(float %a, double %b) { |
| 53 entry: | 78 entry: |
| 54 %call = call i32 @ignoreFpArgsNoInline(float %a, i32 123, double 2.340000e+00) | 79 %call = call i32 @ignoreFpArgsNoInline(float %a, i32 123, double 2.340000e+00) |
| 55 ret i32 %call | 80 ret i32 %call |
| 56 } | 81 } |
| 57 ; CHECK-LABEL: passFpConstArg | 82 ; CHECK-LABEL: passFpConstArg |
| 58 ; CHECK: mov DWORD PTR [esp+0x4],0x7b | 83 ; CHECK: mov DWORD PTR [esp+0x4],0x7b |
| 59 ; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline | 84 ; CHECK: call {{.*}} R_{{.*}} ignoreFpArgsNoInline |
| 85 ; MIPS32-LABEL: passFpConstArg |
| 86 ; MIPS32: mfc1 a2,$f1 |
| 87 ; MIPS32: mfc1 a3,$f0 |
| 88 ; MIPS32: li a1,123 |
| 89 ; MIPS32: jal {{.*}} ignoreFpArgsNoInline |
| 60 | 90 |
| 61 define internal i32 @passFp32ConstArg(float %a) { | 91 define internal i32 @passFp32ConstArg(float %a) { |
| 62 entry: | 92 entry: |
| 63 %call = call i32 @ignoreFp32ArgsNoInline(float %a, i32 123, float 2.0) | 93 %call = call i32 @ignoreFp32ArgsNoInline(float %a, i32 123, float 2.0) |
| 64 ret i32 %call | 94 ret i32 %call |
| 65 } | 95 } |
| 66 ; CHECK-LABEL: passFp32ConstArg | 96 ; CHECK-LABEL: passFp32ConstArg |
| 67 ; CHECK: mov DWORD PTR [esp+0x4],0x7b | 97 ; CHECK: mov DWORD PTR [esp+0x4],0x7b |
| 68 ; CHECK: movss DWORD PTR [esp+0x8] | 98 ; CHECK: movss DWORD PTR [esp+0x8] |
| 69 ; CHECK: call {{.*}} R_{{.*}} ignoreFp32ArgsNoInline | 99 ; CHECK: call {{.*}} R_{{.*}} ignoreFp32ArgsNoInline |
| 100 ; MIPS32-LABEL: passFp32ConstArg |
| 101 ; MIPS32: mfc1 a2,$f0 |
| 102 ; MIPS32: li a1,123 |
| 103 ; MIPS32: jal {{.*}} ignoreFp32ArgsNoInline |
| 70 | 104 |
| 71 declare i32 @ignoreFp32ArgsNoInline(float %x, i32 %y, float %z) | 105 declare i32 @ignoreFp32ArgsNoInline(float %x, i32 %y, float %z) |
| 72 | 106 |
| 73 define internal float @returnFloatArg(float %a) { | 107 define internal float @returnFloatArg(float %a) { |
| 74 entry: | 108 entry: |
| 75 ret float %a | 109 ret float %a |
| 76 } | 110 } |
| 77 ; CHECK-LABEL: returnFloatArg | 111 ; CHECK-LABEL: returnFloatArg |
| 78 ; CHECK: fld DWORD PTR [esp | 112 ; CHECK: fld DWORD PTR [esp |
| 113 ; MIPS32-LABEL: returnFloatArg |
| 114 ; MIPS32: mov.s $f0,$f12 |
| 115 ; MIPS32: jr ra |
| 79 | 116 |
| 80 define internal double @returnDoubleArg(double %a) { | 117 define internal double @returnDoubleArg(double %a) { |
| 81 entry: | 118 entry: |
| 82 ret double %a | 119 ret double %a |
| 83 } | 120 } |
| 84 ; CHECK-LABEL: returnDoubleArg | 121 ; CHECK-LABEL: returnDoubleArg |
| 85 ; CHECK: fld QWORD PTR [esp | 122 ; CHECK: fld QWORD PTR [esp |
| 123 ; MIPS32-LABEL: returnDoubleArg |
| 124 ; MIPS32: mov.d $f0,$f12 |
| 125 ; MIPS32: jr ra |
| 86 | 126 |
| 87 define internal float @returnFloatConst() { | 127 define internal float @returnFloatConst() { |
| 88 entry: | 128 entry: |
| 89 ret float 0x3FF3AE1480000000 | 129 ret float 0x3FF3AE1480000000 |
| 90 } | 130 } |
| 91 ; CHECK-LABEL: returnFloatConst | 131 ; CHECK-LABEL: returnFloatConst |
| 92 ; CHECK: fld | 132 ; CHECK: fld |
| 133 ; MIPS32-LABEL: returnFloatConst |
| 134 ; MIPS32: lui v0,0x0 160: R_MIPS_HI16 .L$float$3f9d70a4 |
| 135 ; MIPS32: lwc1 $f0,0(v0) 164: R_MIPS_LO16 .L$float$3f9d70a4 |
| 136 ; MIPS32: jr ra |
| 93 | 137 |
| 94 define internal double @returnDoubleConst() { | 138 define internal double @returnDoubleConst() { |
| 95 entry: | 139 entry: |
| 96 ret double 1.230000e+00 | 140 ret double 1.230000e+00 |
| 97 } | 141 } |
| 98 ; CHECK-LABEL: returnDoubleConst | 142 ; CHECK-LABEL: returnDoubleConst |
| 99 ; CHECK: fld | 143 ; CHECK: fld |
| 144 ; MIPS32-LABEL: returnDoubleConst |
| 145 ; MIPS32: lui v0,0x0 170: R_MIPS_HI16 .L$double$3ff3ae147ae147ae |
| 146 ; MIPS32: ldc1 $f0,0(v0) 174: R_MIPS_LO16 .L$double$3ff3ae147ae147ae |
| 147 ; MIPS32: jr ra |
| OLD | NEW |