1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -O0 < %s \
3 ; RUN: | FileCheck -check-prefix=NOOPT %s
4 ; RUN: llc -relocation-model=static -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
5 ; RUN: -mcpu=pwr8 < %s | FileCheck -check-prefix=STATIC %s
6 ; RUN: llc -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
7 ; RUN: -mcpu=pwr8 < %s | FileCheck -check-prefix=PIC %s
9 ; Test correct code generation for static and pic for loading and storing a common symbol
11 @comm_glob = common global i32 0, align 4
13 define signext i32 @test_comm() nounwind {
14 ; NOOPT-LABEL: test_comm:
15 ; NOOPT: # %bb.0: # %entry
16 ; NOOPT-NEXT: addis 3, 2, comm_glob@toc@ha
17 ; NOOPT-NEXT: addi 3, 3, comm_glob@toc@l
18 ; NOOPT-NEXT: lwz 4, 0(3)
19 ; NOOPT-NEXT: addi 5, 4, 1
20 ; NOOPT-NEXT: stw 5, 0(3)
21 ; NOOPT-NEXT: extsw 3, 4
24 ; STATIC-LABEL: test_comm:
25 ; STATIC: # %bb.0: # %entry
26 ; STATIC-NEXT: addis 4, 2, comm_glob@toc@ha
27 ; STATIC-NEXT: lwa 3, comm_glob@toc@l(4)
28 ; STATIC-NEXT: addi 5, 3, 1
29 ; STATIC-NEXT: stw 5, comm_glob@toc@l(4)
32 ; PIC-LABEL: test_comm:
33 ; PIC: # %bb.0: # %entry
34 ; PIC-NEXT: addis 3, 2, .LC0@toc@ha
35 ; PIC-NEXT: ld 4, .LC0@toc@l(3)
36 ; PIC-NEXT: lwa 3, 0(4)
37 ; PIC-NEXT: addi 5, 3, 1
38 ; PIC-NEXT: stw 5, 0(4)
41 %0 = load i32, i32* @comm_glob, align 4
42 %inc = add nsw i32 %0, 1
43 store i32 %inc, i32* @comm_glob, align 4