| OLD | NEW |
| 1 ; RUN: %p2i -i %s --target=x8632 --filetype=obj --assemble --disassemble \ | 1 ; RUN: %p2i -i %s --target=x8632 --filetype=obj --assemble --disassemble \ |
| 2 ; RUN: --args -O2 -nonsfi=1 --ffunction-sections \ | 2 ; RUN: --args -O2 -nonsfi=1 --ffunction-sections \ |
| 3 ; RUN: | FileCheck --check-prefix=NONSFI %s | 3 ; RUN: | FileCheck --check-prefix=NONSFI %s |
| 4 ; RUN: %p2i -i %s --target=x8632 --filetype=obj --assemble --disassemble \ | 4 ; RUN: %p2i -i %s --target=x8632 --filetype=obj --assemble --disassemble \ |
| 5 ; RUN: --args -O2 -nonsfi=0 --ffunction-sections \ | 5 ; RUN: --args -O2 -nonsfi=0 --ffunction-sections \ |
| 6 ; RUN: | FileCheck --check-prefix=DEFAULT %s | 6 ; RUN: | FileCheck --check-prefix=DEFAULT %s |
| 7 | 7 |
| 8 ; RUN: %p2i -i %s --target=arm32 --filetype=obj --assemble --disassemble \ | 8 ; RUN: %p2i -i %s --target=arm32 --filetype=obj --assemble --disassemble \ |
| 9 ; RUN: --args -O2 -nonsfi=1 --ffunction-sections \ | 9 ; RUN: --args -O2 -nonsfi=1 --ffunction-sections \ |
| 10 ; RUN: | FileCheck --check-prefix=ARM32-NONSFI %s | 10 ; RUN: | FileCheck --check-prefix=ARM32-NONSFI %s |
| 11 | 11 |
| 12 @G1 = internal global [4 x i8] zeroinitializer, align 4 | 12 @G1 = internal global [4 x i8] zeroinitializer, align 4 |
| 13 @G2 = internal global [4 x i8] zeroinitializer, align 4 | 13 @G2 = internal global [4 x i8] zeroinitializer, align 4 |
| 14 | 14 |
| 15 define internal void @testCallRegular() { | 15 define internal void @testCallRegular() { |
| 16 entry: | 16 entry: |
| 17 ; Make a call to a *different* function, plus use -ffunction-sections, to | 17 ; Make a call to a *different* function, plus use -ffunction-sections, to |
| 18 ; force an appropriately-named relocation. | 18 ; force an appropriately-named relocation. |
| 19 call i32 @testLoadBasic() | 19 call i32 @testLoadBasic() |
| 20 ret void | 20 ret void |
| 21 } | 21 } |
| 22 ; Expect a simple direct call to testCallRegular. | 22 ; Expect a simple direct call to testCallRegular. |
| 23 ; NONSFI-LABEL: testCallRegular | 23 ; NONSFI-LABEL: testCallRegular |
| 24 ; NONSFI: call {{.*}} R_386_PC32 {{.*}}testLoadBasic | 24 ; NONSFI: call {{.*}} R_386_PC32 {{.*}}testLoadBasic |
| 25 ; DEFAULT-LABEL: testCallRegular | 25 ; DEFAULT-LABEL: testCallRegular |
| 26 | 26 |
| 27 ; ARM32-NONSFI-LABEL: testCallRegular | 27 ; ARM32-NONSFI-LABEL: testCallRegular |
| 28 ; ARM32-NONSFI: movw [[REG:r[0-9]+]], {{.*}} R_ARM_MOVW_PREL_NC GOTOFF{{.*}
}testLoadBasic | 28 ; ARM32-NONSFI: bl {{.*}} R_ARM_CALL {{.*}}testLoadBasic |
| 29 ; ARM32-NONSFI-NEXT: movt [[REG:r[0-9]+]], {{.*}} R_ARM_MOVT_PREL GOTOFF{{.*}}te
stLoadBasic | |
| 30 ; ARM32-NONSFI-NEXT: ldr [[GOTOFF:r[0-9]+]], [pc, [[REG]]] | |
| 31 ; ARM32-NONSFI-NEXT: add [[CT:r[0-9]+]], {{.*}}, [[CT]] | |
| 32 ; ARM32-NONSFI: blx [[CT]] | |
| 33 | 29 |
| 34 define internal double @testCallBuiltin(double %val) { | 30 define internal double @testCallBuiltin(double %val) { |
| 35 entry: | 31 entry: |
| 36 %result = frem double %val, %val | 32 %result = frem double %val, %val |
| 37 ret double %result | 33 ret double %result |
| 38 } | 34 } |
| 39 ; Expect a simple direct call to fmod. | 35 ; Expect a simple direct call to fmod. |
| 40 ; NONSFI-LABEL: testCallBuiltin | 36 ; NONSFI-LABEL: testCallBuiltin |
| 41 ; NONSFI: call {{.*}} R_386_PC32 fmod | 37 ; NONSFI: call {{.*}} R_386_PC32 fmod |
| 42 ; DEFAULT-LABEL: testCallBuiltin | 38 ; DEFAULT-LABEL: testCallBuiltin |
| 43 | 39 |
| 44 ; ARM32-NONSFI-LABEL: testCallBuiltin | 40 ; ARM32-NONSFI-LABEL: testCallBuiltin |
| 45 ; ARM32-NONSFI: movw [[REG:r[0-9]+]], {{.*}} R_ARM_MOVW_PREL_NC GOTOFF{{.*}
}fmod | 41 ; ARM32-NONSFI: bl {{.*}} R_ARM_CALL {{.*}}fmod |
| 46 ; ARM32-NONSFI-NEXT: movt [[REG:r[0-9]+]], {{.*}} R_ARM_MOVT_PREL GOTOFF{{.*}}fm
od | |
| 47 ; ARM32-NONSFI-NEXT: ldr [[GOTOFF:r[0-9]+]], [pc, [[REG]]] | |
| 48 ; ARM32-NONSFI-NEXT: add [[CT:r[0-9]+]], {{.*}}, [[CT]] | |
| 49 ; ARM32-NONSFI: blx [[CT]] | |
| 50 | 42 |
| 51 define internal i32 @testLoadBasic() { | 43 define internal i32 @testLoadBasic() { |
| 52 entry: | 44 entry: |
| 53 %a = bitcast [4 x i8]* @G1 to i32* | 45 %a = bitcast [4 x i8]* @G1 to i32* |
| 54 %b = load i32, i32* %a, align 1 | 46 %b = load i32, i32* %a, align 1 |
| 55 ret i32 %b | 47 ret i32 %b |
| 56 } | 48 } |
| 57 ; Expect a load with a R_386_GOTOFF relocation. | 49 ; Expect a load with a R_386_GOTOFF relocation. |
| 58 ; NONSFI-LABEL: testLoadBasic | 50 ; NONSFI-LABEL: testLoadBasic |
| 59 ; NONSFI: mov {{.*}} R_386_GOTOFF {{G1|.bss}} | 51 ; NONSFI: mov {{.*}} R_386_GOTOFF {{G1|.bss}} |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 %a = bitcast [4 x i8]* @G1 to i32* | 146 %a = bitcast [4 x i8]* @G1 to i32* |
| 155 %b = load i32, i32* %a, align 1 | 147 %b = load i32, i32* %a, align 1 |
| 156 %c = add i32 %b, 1234 | 148 %c = add i32 %b, 1234 |
| 157 store i32 %c, i32* %a, align 1 | 149 store i32 %c, i32* %a, align 1 |
| 158 ret void | 150 ret void |
| 159 } | 151 } |
| 160 ; Expect an RMW optimization with a R_386_GOTOFF relocation. | 152 ; Expect an RMW optimization with a R_386_GOTOFF relocation. |
| 161 ; NONSFI-LABEL: testRMW | 153 ; NONSFI-LABEL: testRMW |
| 162 ; NONSFI: add DWORD PTR {{.*}}+0x0],0x4d2 {{.*}} R_386_GOTOFF {{G1|.bss}} | 154 ; NONSFI: add DWORD PTR {{.*}}+0x0],0x4d2 {{.*}} R_386_GOTOFF {{G1|.bss}} |
| 163 ; DEFAULT-LABEL: testRMW | 155 ; DEFAULT-LABEL: testRMW |
| OLD | NEW |