Skip to content

Commit e07fc3b

Browse files
committed
PPC64LE: Add CFI annotations via autogen
Teach scripts/cfify to emit DWARF CFI directives for the ppc64le prologue/epilogue (frame alloc, GPR and Altivec spill/restore, return) and drop the ppc64le carve-out in scripts/autogen so simpasm runs with --cfify. Regenerates the four ppc64le .S backends with CFI; instruction text is unchanged. - Resolves #1725 Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
1 parent d9613cf commit e07fc3b

6 files changed

Lines changed: 271 additions & 7 deletions

File tree

mlkem/src/native/ppc64le/src/intt_ppc_asm.S

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,41 +20,64 @@
2020
.global MLK_ASM_NAMESPACE(intt_ppc_asm)
2121
MLK_ASM_FN_SYMBOL(intt_ppc_asm)
2222

23+
.cfi_startproc
2324
stdu 1, -352(1)
25+
.cfi_def_cfa 1, 352
2426
mflr 0
2527
std 14, 56(1)
28+
.cfi_offset 14, -296
2629
std 15, 64(1)
30+
.cfi_offset 15, -288
2731
std 16, 72(1)
32+
.cfi_offset 16, -280
2833
std 17, 80(1)
34+
.cfi_offset 17, -272
2935
std 18, 88(1)
36+
.cfi_offset 18, -264
3037
std 19, 96(1)
38+
.cfi_offset 19, -256
3139
std 20, 104(1)
40+
.cfi_offset 20, -248
3241
std 21, 112(1)
42+
.cfi_offset 21, -240
3343
std 22, 120(1)
44+
.cfi_offset 22, -232
3445
li 10, 128
3546
li 11, 144
3647
li 12, 160
3748
li 14, 176
3849
li 15, 192
3950
li 16, 208
4051
stxvd2x 52, 10, 1
52+
.cfi_offset 1144, -224
4153
stxvd2x 53, 11, 1
54+
.cfi_offset 1145, -208
4255
stxvd2x 54, 12, 1
56+
.cfi_offset 1146, -192
4357
stxvd2x 55, 14, 1
58+
.cfi_offset 1147, -176
4459
stxvd2x 56, 15, 1
60+
.cfi_offset 1148, -160
4561
stxvd2x 57, 16, 1
62+
.cfi_offset 1149, -144
4663
li 10, 224
4764
li 11, 240
4865
li 12, 256
4966
li 14, 272
5067
li 15, 288
5168
li 16, 304
5269
stxvd2x 58, 10, 1
70+
.cfi_offset 1150, -128
5371
stxvd2x 59, 11, 1
72+
.cfi_offset 1151, -112
5473
stxvd2x 60, 12, 1
74+
.cfi_offset 1152, -96
5575
stxvd2x 61, 14, 1
76+
.cfi_offset 1153, -80
5677
stxvd2x 62, 15, 1
78+
.cfi_offset 1154, -64
5779
stxvd2x 63, 16, 1
80+
.cfi_offset 1155, -48
5881
lxvd2x 0, 0, 4
5982
xxlxor 35, 35, 35
6083
xxlor 3, 35, 35
@@ -84,7 +107,7 @@ MLK_ASM_FN_SYMBOL(intt_ppc_asm)
84107
mtctr 8
85108
xxlor 37, 0, 0
86109

87-
intt_ppc_asm_Loopf:
110+
Lintt_ppc_asm_Loopf:
88111
lxvd2x 57, 0, 3
89112
lxvd2x 58, 10, 3
90113
lxvd2x 62, 11, 3
@@ -129,7 +152,7 @@ intt_ppc_asm_Loopf:
129152
stxvd2x 55, 17, 3
130153
stxvd2x 60, 18, 3
131154
addi 3, 3, 128
132-
bdnz intt_ppc_asm_Loopf
155+
bdnz Lintt_ppc_asm_Loopf
133156
addi 3, 3, -512
134157
nop
135158
nop
@@ -3182,35 +3205,58 @@ intt_ppc_asm_Loopf:
31823205
li 15, 192
31833206
li 16, 208
31843207
lxvd2x 52, 10, 1
3208+
.cfi_restore 1144
31853209
lxvd2x 53, 11, 1
3210+
.cfi_restore 1145
31863211
lxvd2x 54, 12, 1
3212+
.cfi_restore 1146
31873213
lxvd2x 55, 14, 1
3214+
.cfi_restore 1147
31883215
lxvd2x 56, 15, 1
3216+
.cfi_restore 1148
31893217
lxvd2x 57, 16, 1
3218+
.cfi_restore 1149
31903219
li 10, 224
31913220
li 11, 240
31923221
li 12, 256
31933222
li 14, 272
31943223
li 15, 288
31953224
li 16, 304
31963225
lxvd2x 58, 10, 1
3226+
.cfi_restore 1150
31973227
lxvd2x 59, 11, 1
3228+
.cfi_restore 1151
31983229
lxvd2x 60, 12, 1
3230+
.cfi_restore 1152
31993231
lxvd2x 61, 14, 1
3232+
.cfi_restore 1153
32003233
lxvd2x 62, 15, 1
3234+
.cfi_restore 1154
32013235
lxvd2x 63, 16, 1
3236+
.cfi_restore 1155
32023237
ld 14, 56(1)
3238+
.cfi_restore 14
32033239
ld 15, 64(1)
3240+
.cfi_restore 15
32043241
ld 16, 72(1)
3242+
.cfi_restore 16
32053243
ld 17, 80(1)
3244+
.cfi_restore 17
32063245
ld 18, 88(1)
3246+
.cfi_restore 18
32073247
ld 19, 96(1)
3248+
.cfi_restore 19
32083249
ld 20, 104(1)
3250+
.cfi_restore 20
32093251
ld 21, 112(1)
3252+
.cfi_restore 21
32103253
ld 22, 120(1)
3254+
.cfi_restore 22
32113255
mtlr 0
32123256
addi 1, 1, 352
3257+
.cfi_def_cfa 1, 0
32133258
blr
3259+
.cfi_endproc
32143260

32153261
MLK_ASM_FN_SIZE(intt_ppc_asm)
32163262

mlkem/src/native/ppc64le/src/ntt_ppc_asm.S

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,41 +20,64 @@
2020
.global MLK_ASM_NAMESPACE(ntt_ppc_asm)
2121
MLK_ASM_FN_SYMBOL(ntt_ppc_asm)
2222

23+
.cfi_startproc
2324
stdu 1, -352(1)
25+
.cfi_def_cfa 1, 352
2426
mflr 0
2527
std 14, 56(1)
28+
.cfi_offset 14, -296
2629
std 15, 64(1)
30+
.cfi_offset 15, -288
2731
std 16, 72(1)
32+
.cfi_offset 16, -280
2833
std 17, 80(1)
34+
.cfi_offset 17, -272
2935
std 18, 88(1)
36+
.cfi_offset 18, -264
3037
std 19, 96(1)
38+
.cfi_offset 19, -256
3139
std 20, 104(1)
40+
.cfi_offset 20, -248
3241
std 21, 112(1)
42+
.cfi_offset 21, -240
3343
std 22, 120(1)
44+
.cfi_offset 22, -232
3445
li 10, 128
3546
li 11, 144
3647
li 12, 160
3748
li 14, 176
3849
li 15, 192
3950
li 16, 208
4051
stxvd2x 52, 10, 1
52+
.cfi_offset 1144, -224
4153
stxvd2x 53, 11, 1
54+
.cfi_offset 1145, -208
4255
stxvd2x 54, 12, 1
56+
.cfi_offset 1146, -192
4357
stxvd2x 55, 14, 1
58+
.cfi_offset 1147, -176
4459
stxvd2x 56, 15, 1
60+
.cfi_offset 1148, -160
4561
stxvd2x 57, 16, 1
62+
.cfi_offset 1149, -144
4663
li 10, 224
4764
li 11, 240
4865
li 12, 256
4966
li 14, 272
5067
li 15, 288
5168
li 16, 304
5269
stxvd2x 58, 10, 1
70+
.cfi_offset 1150, -128
5371
stxvd2x 59, 11, 1
72+
.cfi_offset 1151, -112
5473
stxvd2x 60, 12, 1
74+
.cfi_offset 1152, -96
5575
stxvd2x 61, 14, 1
76+
.cfi_offset 1153, -80
5677
stxvd2x 62, 15, 1
78+
.cfi_offset 1154, -64
5779
stxvd2x 63, 16, 1
80+
.cfi_offset 1155, -48
5881
lvx 5, 0, 4
5982
addi 14, 4, 112
6083
addi 22, 4, 2128
@@ -1611,35 +1634,58 @@ MLK_ASM_FN_SYMBOL(ntt_ppc_asm)
16111634
li 15, 192
16121635
li 16, 208
16131636
lxvd2x 52, 10, 1
1637+
.cfi_restore 1144
16141638
lxvd2x 53, 11, 1
1639+
.cfi_restore 1145
16151640
lxvd2x 54, 12, 1
1641+
.cfi_restore 1146
16161642
lxvd2x 55, 14, 1
1643+
.cfi_restore 1147
16171644
lxvd2x 56, 15, 1
1645+
.cfi_restore 1148
16181646
lxvd2x 57, 16, 1
1647+
.cfi_restore 1149
16191648
li 10, 224
16201649
li 11, 240
16211650
li 12, 256
16221651
li 14, 272
16231652
li 15, 288
16241653
li 16, 304
16251654
lxvd2x 58, 10, 1
1655+
.cfi_restore 1150
16261656
lxvd2x 59, 11, 1
1657+
.cfi_restore 1151
16271658
lxvd2x 60, 12, 1
1659+
.cfi_restore 1152
16281660
lxvd2x 61, 14, 1
1661+
.cfi_restore 1153
16291662
lxvd2x 62, 15, 1
1663+
.cfi_restore 1154
16301664
lxvd2x 63, 16, 1
1665+
.cfi_restore 1155
16311666
ld 14, 56(1)
1667+
.cfi_restore 14
16321668
ld 15, 64(1)
1669+
.cfi_restore 15
16331670
ld 16, 72(1)
1671+
.cfi_restore 16
16341672
ld 17, 80(1)
1673+
.cfi_restore 17
16351674
ld 18, 88(1)
1675+
.cfi_restore 18
16361676
ld 19, 96(1)
1677+
.cfi_restore 19
16371678
ld 20, 104(1)
1679+
.cfi_restore 20
16381680
ld 21, 112(1)
1681+
.cfi_restore 21
16391682
ld 22, 120(1)
1683+
.cfi_restore 22
16401684
mtlr 0
16411685
addi 1, 1, 352
1686+
.cfi_def_cfa 1, 0
16421687
blr
1688+
.cfi_endproc
16431689

16441690
MLK_ASM_FN_SIZE(ntt_ppc_asm)
16451691

mlkem/src/native/ppc64le/src/poly_tomont_ppc_asm.S

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
.global MLK_ASM_NAMESPACE(poly_tomont_ppc_asm)
2828
MLK_ASM_FN_SYMBOL(poly_tomont_ppc_asm)
2929

30+
.cfi_startproc
3031
stdu 1, -320(1)
32+
.cfi_def_cfa 1, 320
3133
mflr 0
3234
li 6, 128
3335
li 7, 144
@@ -37,20 +39,31 @@ MLK_ASM_FN_SYMBOL(poly_tomont_ppc_asm)
3739
li 11, 208
3840
li 12, 224
3941
stxvd2x 52, 6, 1
42+
.cfi_offset 1144, -192
4043
stxvd2x 53, 7, 1
44+
.cfi_offset 1145, -176
4145
stxvd2x 54, 8, 1
46+
.cfi_offset 1146, -160
4247
stxvd2x 55, 9, 1
48+
.cfi_offset 1147, -144
4349
stxvd2x 56, 10, 1
50+
.cfi_offset 1148, -128
4451
stxvd2x 57, 11, 1
52+
.cfi_offset 1149, -112
4553
stxvd2x 58, 12, 1
54+
.cfi_offset 1150, -96
4655
li 6, 240
4756
li 7, 256
4857
li 8, 272
4958
li 9, 288
5059
stxvd2x 59, 6, 1
60+
.cfi_offset 1151, -80
5161
stxvd2x 60, 7, 1
62+
.cfi_offset 1152, -64
5263
stxvd2x 61, 8, 1
64+
.cfi_offset 1153, -48
5365
stxvd2x 62, 9, 1
66+
.cfi_offset 1154, -32
5467
li 6, 0
5568
li 7, 80
5669
li 8, 96
@@ -266,23 +279,36 @@ MLK_ASM_FN_SYMBOL(poly_tomont_ppc_asm)
266279
li 11, 208
267280
li 12, 224
268281
lxvd2x 52, 6, 1
282+
.cfi_restore 1144
269283
lxvd2x 53, 7, 1
284+
.cfi_restore 1145
270285
lxvd2x 54, 8, 1
286+
.cfi_restore 1146
271287
lxvd2x 55, 9, 1
288+
.cfi_restore 1147
272289
lxvd2x 56, 10, 1
290+
.cfi_restore 1148
273291
lxvd2x 57, 11, 1
292+
.cfi_restore 1149
274293
lxvd2x 58, 12, 1
294+
.cfi_restore 1150
275295
li 6, 240
276296
li 7, 256
277297
li 8, 272
278298
li 9, 288
279299
lxvd2x 59, 6, 1
300+
.cfi_restore 1151
280301
lxvd2x 60, 7, 1
302+
.cfi_restore 1152
281303
lxvd2x 61, 8, 1
304+
.cfi_restore 1153
282305
lxvd2x 62, 9, 1
306+
.cfi_restore 1154
283307
mtlr 0
284308
addi 1, 1, 320
309+
.cfi_def_cfa 1, 0
285310
blr
311+
.cfi_endproc
286312

287313
MLK_ASM_FN_SIZE(poly_tomont_ppc_asm)
288314

0 commit comments

Comments
 (0)