File: ppc-partword-atomic.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (114 lines) | stat: -rw-r--r-- 3,748 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-- -mcpu=pwr7 %s -o - | FileCheck %s --check-prefix=PWR7
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-- -mcpu=pwr9 %s -o - | FileCheck %s --check-prefix=PWR9

@value8 = dso_local global { i8 } zeroinitializer, align 1
@value16 = dso_local global { i16 } zeroinitializer, align 2
@global_int = dso_local local_unnamed_addr global i32 0, align 4

define dso_local zeroext i32 @testI8(i8 zeroext %val) local_unnamed_addr #0 {
; PWR7-LABEL: testI8:
; PWR7:       # %bb.0: # %entry
; PWR7-NEXT:    addis 4, 2, value8@toc@ha
; PWR7-NEXT:    li 6, 255
; PWR7-NEXT:    sync
; PWR7-NEXT:    addi 5, 4, value8@toc@l
; PWR7-NEXT:    rlwinm 4, 5, 3, 27, 28
; PWR7-NEXT:    rldicr 5, 5, 0, 61
; PWR7-NEXT:    xori 4, 4, 24
; PWR7-NEXT:    slw 7, 3, 4
; PWR7-NEXT:    slw 3, 6, 4
; PWR7-NEXT:    and 6, 7, 3
; PWR7-NEXT:  .LBB0_1: # %entry
; PWR7-NEXT:    #
; PWR7-NEXT:    lwarx 7, 0, 5
; PWR7-NEXT:    andc 8, 7, 3
; PWR7-NEXT:    or 8, 6, 8
; PWR7-NEXT:    stwcx. 8, 0, 5
; PWR7-NEXT:    bne 0, .LBB0_1
; PWR7-NEXT:  # %bb.2: # %entry
; PWR7-NEXT:    srw 3, 7, 4
; PWR7-NEXT:    addis 5, 2, global_int@toc@ha
; PWR7-NEXT:    lwsync
; PWR7-NEXT:    clrlwi 4, 3, 24
; PWR7-NEXT:    li 3, 55
; PWR7-NEXT:    stw 4, global_int@toc@l(5)
; PWR7-NEXT:    blr
;
; PWR9-LABEL: testI8:
; PWR9:       # %bb.0: # %entry
; PWR9-NEXT:    addis 4, 2, value8@toc@ha
; PWR9-NEXT:    sync
; PWR9-NEXT:    addi 5, 4, value8@toc@l
; PWR9-NEXT:  .LBB0_1: # %entry
; PWR9-NEXT:    #
; PWR9-NEXT:    lbarx 4, 0, 5
; PWR9-NEXT:    stbcx. 3, 0, 5
; PWR9-NEXT:    bne 0, .LBB0_1
; PWR9-NEXT:  # %bb.2: # %entry
; PWR9-NEXT:    addis 3, 2, global_int@toc@ha
; PWR9-NEXT:    lwsync
; PWR9-NEXT:    stw 4, global_int@toc@l(3)
; PWR9-NEXT:    li 3, 55
; PWR9-NEXT:    blr
entry:
  %0 = atomicrmw xchg i8* getelementptr inbounds ({ i8 }, { i8 }* @value8, i64 0, i32 0), i8 %val seq_cst, align 1
  %conv = zext i8 %0 to i32
  store i32 %conv, i32* @global_int, align 4
  ret i32 55
}

define dso_local zeroext i32 @testI16(i16 zeroext %val) local_unnamed_addr #0 {
; PWR7-LABEL: testI16:
; PWR7:       # %bb.0: # %entry
; PWR7-NEXT:    addis 4, 2, value16@toc@ha
; PWR7-NEXT:    li 6, 0
; PWR7-NEXT:    sync
; PWR7-NEXT:    addi 5, 4, value16@toc@l
; PWR7-NEXT:    ori 6, 6, 65535
; PWR7-NEXT:    rlwinm 4, 5, 3, 27, 27
; PWR7-NEXT:    rldicr 5, 5, 0, 61
; PWR7-NEXT:    xori 4, 4, 16
; PWR7-NEXT:    slw 7, 3, 4
; PWR7-NEXT:    slw 3, 6, 4
; PWR7-NEXT:    and 6, 7, 3
; PWR7-NEXT:  .LBB1_1: # %entry
; PWR7-NEXT:    #
; PWR7-NEXT:    lwarx 7, 0, 5
; PWR7-NEXT:    andc 8, 7, 3
; PWR7-NEXT:    or 8, 6, 8
; PWR7-NEXT:    stwcx. 8, 0, 5
; PWR7-NEXT:    bne 0, .LBB1_1
; PWR7-NEXT:  # %bb.2: # %entry
; PWR7-NEXT:    srw 3, 7, 4
; PWR7-NEXT:    addis 5, 2, global_int@toc@ha
; PWR7-NEXT:    lwsync
; PWR7-NEXT:    clrlwi 4, 3, 16
; PWR7-NEXT:    li 3, 55
; PWR7-NEXT:    stw 4, global_int@toc@l(5)
; PWR7-NEXT:    blr
;
; PWR9-LABEL: testI16:
; PWR9:       # %bb.0: # %entry
; PWR9-NEXT:    addis 4, 2, value16@toc@ha
; PWR9-NEXT:    sync
; PWR9-NEXT:    addi 5, 4, value16@toc@l
; PWR9-NEXT:  .LBB1_1: # %entry
; PWR9-NEXT:    #
; PWR9-NEXT:    lharx 4, 0, 5
; PWR9-NEXT:    sthcx. 3, 0, 5
; PWR9-NEXT:    bne 0, .LBB1_1
; PWR9-NEXT:  # %bb.2: # %entry
; PWR9-NEXT:    addis 3, 2, global_int@toc@ha
; PWR9-NEXT:    lwsync
; PWR9-NEXT:    stw 4, global_int@toc@l(3)
; PWR9-NEXT:    li 3, 55
; PWR9-NEXT:    blr
entry:
  %0 = atomicrmw xchg i16* getelementptr inbounds ({ i16 }, { i16 }* @value16, i64 0, i32 0), i16 %val seq_cst, align 2
  %conv = zext i16 %0 to i32
  store i32 %conv, i32* @global_int, align 4
  ret i32 55
}

attributes #0 = { nounwind }