Skip to content

Commit 87e5bbd

Browse files
committed
s390x: avoid variable-length arrays in struct for asm operands
... since it is not required and clang does not support that gcc extension. Instead, use a variable-length array directly for these operands. Note that, while the actual inline assembly code does not directly use these memory operands, they serve to inform the compiler that it cannot reorder reads or writes to/from the input and output data across the inline asm statements. Signed-off-by: Marius Hillenbrand <[email protected]>
1 parent b9b3265 commit 87e5bbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+212
-212
lines changed

kernel/zarch/camax.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static FLOAT camax_kernel_32(BLASLONG n, FLOAT *x) {
136136
"wfmaxsb %%v0,%%v0,%%v16,0\n\t"
137137
"ler %[amax],%%f0"
138138
: [amax] "=f"(amax),[n] "+&r"(n)
139-
: "m"(*(const struct { FLOAT x[n * 2]; } *) x),[x] "a"(x)
139+
: "m"(*(const FLOAT (*)[n * 2]) x),[x] "a"(x)
140140
: "cc", "r1", "v0", "v1", "v2", "v16", "v17", "v18", "v19", "v20",
141141
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
142142
"v31");

kernel/zarch/camin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static FLOAT camin_kernel_32(BLASLONG n, FLOAT *x) {
136136
"wfminsb %%v0,%%v0,%%v16,0\n\t"
137137
"ler %[amin],%%f0"
138138
: [amin] "=f"(amin),[n] "+&r"(n)
139-
: "m"(*(const struct { FLOAT x[n * 2]; } *) x),[x] "a"(x)
139+
: "m"(*(const FLOAT (*)[n * 2]) x),[x] "a"(x)
140140
: "cc", "r1", "v0", "v1", "v2", "v16", "v17", "v18", "v19", "v20",
141141
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
142142
"v31");

kernel/zarch/casum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static FLOAT casum_kernel_32(BLASLONG n, FLOAT *x) {
108108
"vfasb %%v24,%%v24,%%v25\n\t"
109109
"vstef %%v24,%[asum],0"
110110
: [asum] "=Q"(asum),[n] "+&r"(n)
111-
: "m"(*(const struct { FLOAT x[n * 2]; } *) x),[x] "a"(x)
111+
: "m"(*(const FLOAT (*)[n * 2]) x),[x] "a"(x)
112112
: "cc", "r1", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
113113
"v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31");
114114

kernel/zarch/caxpy.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ static void caxpy_kernel_16(BLASLONG n, FLOAT *x, FLOAT *y, FLOAT *alpha) {
9999
"vst %%v19,112(%%r1,%[y])\n\t"
100100
"agfi %%r1,128\n\t"
101101
"brctg %[n],0b"
102-
: "+m"(*(struct { FLOAT x[n * 2]; } *) y),[n] "+&r"(n)
103-
: [y] "a"(y), "m"(*(const struct { FLOAT x[n * 2]; } *) x),[x] "a"(x),
104-
"m"(*(const struct { FLOAT x[2]; } *) alpha),[alpha] "a"(alpha)
102+
: "+m"(*(FLOAT (*)[n * 2]) y),[n] "+&r"(n)
103+
: [y] "a"(y), "m"(*(const FLOAT (*)[n * 2]) x),[x] "a"(x),
104+
"m"(*(const FLOAT (*)[2]) alpha),[alpha] "a"(alpha)
105105
: "cc", "r1", "v0", "v1", "v8", "v9", "v10", "v11", "v12", "v13",
106106
"v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
107107
"v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31");

kernel/zarch/ccopy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ static void ccopy_kernel_32(BLASLONG n, FLOAT *x, FLOAT *y) {
3636
"la %[x],256(%[x])\n\t"
3737
"la %[y],256(%[y])\n\t"
3838
"brctg %[n],0b"
39-
: "=m"(*(struct { FLOAT x[n * 2]; } *) y),[x] "+&a"(x),[y] "+&a"(y),
39+
: "=m"(*(FLOAT (*)[n * 2]) y),[x] "+&a"(x),[y] "+&a"(y),
4040
[n] "+&r"(n)
41-
: "m"(*(const struct { FLOAT x[n * 2]; } *) x)
41+
: "m"(*(const FLOAT (*)[n * 2]) x)
4242
: "cc");
4343
}
4444

kernel/zarch/cdot.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ static void cdot_kernel_16(BLASLONG n, FLOAT *x, FLOAT *y, FLOAT *d) {
9797
"vstef %%v24,4(%[d]),1\n\t"
9898
"vstef %%v25,8(%[d]),1\n\t"
9999
"vstef %%v25,12(%[d]),0"
100-
: "=m"(*(struct { FLOAT x[4]; } *) d),[n] "+&r"(n)
101-
: [d] "a"(d), "m"(*(const struct { FLOAT x[n * 2]; } *) x),[x] "a"(x),
102-
"m"(*(const struct { FLOAT x[n * 2]; } *) y),[y] "a"(y)
100+
: "=m"(*(FLOAT (*)[4]) d),[n] "+&r"(n)
101+
: [d] "a"(d), "m"(*(const FLOAT (*)[n * 2]) x),[x] "a"(x),
102+
"m"(*(const FLOAT (*)[n * 2]) y),[y] "a"(y)
103103
: "cc", "r1", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19", "v20",
104104
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
105105
"v31");

kernel/zarch/cgemv_n_4.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ static void cgemv_kernel_4x4(BLASLONG n, FLOAT **ap, FLOAT *x, FLOAT *y) {
146146
"vst %%v0,0(%%r1,%[y])\n\t"
147147
"agfi %%r1,16\n\t"
148148
"brctg %[n],0b\n\t"
149-
: "+m"(*(struct { FLOAT x[n * 2]; } *) y),[n] "+&r"(n)
150-
: [y] "a"(y), "m"(*(const struct { FLOAT x[n * 2]; } *) ap0),[ap0] "a"(ap0),
151-
"m"(*(const struct { FLOAT x[n * 2]; } *) ap1),[ap1] "a"(ap1),
152-
"m"(*(const struct { FLOAT x[n * 2]; } *) ap2),[ap2] "a"(ap2),
153-
"m"(*(const struct { FLOAT x[n * 2]; } *) ap3),[ap3] "a"(ap3),
154-
"m"(*(const struct { FLOAT x[8]; } *) x),[x] "a"(x)
149+
: "+m"(*(FLOAT (*)[n * 2]) y),[n] "+&r"(n)
150+
: [y] "a"(y), "m"(*(const FLOAT (*)[n * 2]) ap0),[ap0] "a"(ap0),
151+
"m"(*(const FLOAT (*)[n * 2]) ap1),[ap1] "a"(ap1),
152+
"m"(*(const FLOAT (*)[n * 2]) ap2),[ap2] "a"(ap2),
153+
"m"(*(const FLOAT (*)[n * 2]) ap3),[ap3] "a"(ap3),
154+
"m"(*(const FLOAT (*)[8]) x),[x] "a"(x)
155155
: "cc", "r1", "v0", "v1", "v2", "v16", "v17", "v18", "v19", "v20",
156156
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
157157
"v31");
@@ -238,10 +238,10 @@ static void cgemv_kernel_4x2(BLASLONG n, FLOAT **ap, FLOAT *x, FLOAT *y) {
238238
"vst %%v0,0(%%r1,%[y])\n\t"
239239
"agfi %%r1,16\n\t"
240240
"brctg %[n],0b\n\t"
241-
: "+m"(*(struct { FLOAT x[n * 2]; } *) y),[n] "+&r"(n)
242-
: [y] "a"(y), "m"(*(const struct { FLOAT x[n * 2]; } *) ap0),[ap0] "a"(ap0),
243-
"m"(*(const struct { FLOAT x[n * 2]; } *) ap1),[ap1] "a"(ap1),
244-
"m"(*(const struct { FLOAT x[4]; } *) x),[x] "a"(x)
241+
: "+m"(*(FLOAT (*)[n * 2]) y),[n] "+&r"(n)
242+
: [y] "a"(y), "m"(*(const FLOAT (*)[n * 2]) ap0),[ap0] "a"(ap0),
243+
"m"(*(const FLOAT (*)[n * 2]) ap1),[ap1] "a"(ap1),
244+
"m"(*(const FLOAT (*)[4]) x),[x] "a"(x)
245245
: "cc", "r1", "v0", "v1", "v2", "v16", "v17", "v18", "v19", "v20",
246246
"v21", "v22", "v23");
247247
}
@@ -307,9 +307,9 @@ static void cgemv_kernel_4x1(BLASLONG n, FLOAT *ap, FLOAT *x, FLOAT *y) {
307307
"vst %%v0,0(%%r1,%[y])\n\t"
308308
"agfi %%r1,16\n\t"
309309
"brctg %[n],0b\n\t"
310-
: "+m"(*(struct { FLOAT x[n * 2]; } *) y),[n] "+&r"(n)
311-
: [y] "a"(y), "m"(*(const struct { FLOAT x[n * 2]; } *) ap),[ap] "a"(ap),
312-
"m"(*(const struct { FLOAT x[2]; } *) x),[x] "a"(x)
310+
: "+m"(*(FLOAT (*)[n * 2]) y),[n] "+&r"(n)
311+
: [y] "a"(y), "m"(*(const FLOAT (*)[n * 2]) ap),[ap] "a"(ap),
312+
"m"(*(const FLOAT (*)[2]) x),[x] "a"(x)
313313
: "cc", "r1", "v0", "v1", "v2", "v16", "v17", "v18", "v19");
314314
}
315315

@@ -350,8 +350,8 @@ static void add_y_4(BLASLONG n, FLOAT *src, FLOAT *dest, FLOAT alpha_r,
350350
"vst %%v23,16(%%r1,%[dest])\n\t"
351351
"agfi %%r1,32\n\t"
352352
"brctg %[n],0b"
353-
: "+m"(*(struct { FLOAT x[n * 2]; } *) dest),[n] "+&r"(n)
354-
: [dest] "a"(dest), "m"(*(const struct { FLOAT x[n * 2]; } *) src),
353+
: "+m"(*(FLOAT (*)[n * 2]) dest),[n] "+&r"(n)
354+
: [dest] "a"(dest), "m"(*(const FLOAT (*)[n * 2]) src),
355355
[src] "a"(src),[alpha_r] "Q"(alpha_r),[alpha_i] "Q"(alpha_i)
356356
: "cc", "r1", "v0", "v1", "v16", "v17", "v18", "v19", "v20", "v21",
357357
"v22", "v23");

kernel/zarch/cgemv_t_4.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ static void cgemv_kernel_4x4(BLASLONG n, FLOAT **ap, FLOAT *x, FLOAT *y,
159159
"vfmasb %%v23,%%v19,%%v21,%%v23\n\t"
160160
"vst %%v22,0(%[y])\n\t"
161161
"vst %%v23,16(%[y])"
162-
: "+m"(*(struct { FLOAT x[8]; } *) y),[n] "+&r"(n)
163-
: [y] "a"(y), "m"(*(const struct { FLOAT x[n * 2]; } *) ap0),[ap0] "a"(ap0),
164-
"m"(*(const struct { FLOAT x[n * 2]; } *) ap1),[ap1] "a"(ap1),
165-
"m"(*(const struct { FLOAT x[n * 2]; } *) ap2),[ap2] "a"(ap2),
166-
"m"(*(const struct { FLOAT x[n * 2]; } *) ap3),[ap3] "a"(ap3),
167-
"m"(*(const struct { FLOAT x[n * 2]; } *) x),[x] "a"(x),
168-
"m"(*(const struct { FLOAT x[2]; } *) alpha),[alpha] "a"(alpha)
162+
: "+m"(*(FLOAT (*)[8]) y),[n] "+&r"(n)
163+
: [y] "a"(y), "m"(*(const FLOAT (*)[n * 2]) ap0),[ap0] "a"(ap0),
164+
"m"(*(const FLOAT (*)[n * 2]) ap1),[ap1] "a"(ap1),
165+
"m"(*(const FLOAT (*)[n * 2]) ap2),[ap2] "a"(ap2),
166+
"m"(*(const FLOAT (*)[n * 2]) ap3),[ap3] "a"(ap3),
167+
"m"(*(const FLOAT (*)[n * 2]) x),[x] "a"(x),
168+
"m"(*(const FLOAT (*)[2]) alpha),[alpha] "a"(alpha)
169169
: "cc", "r1", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19", "v20",
170170
"v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
171171
"v31");
@@ -271,11 +271,11 @@ static void cgemv_kernel_4x2(BLASLONG n, FLOAT **ap, FLOAT *x, FLOAT *y,
271271
"vfmasb %%v20,%%v16,%%v18,%%v20\n\t"
272272
"vfmasb %%v20,%%v17,%%v19,%%v20\n\t"
273273
"vst %%v20,0(%[y])"
274-
: "+m"(*(struct { FLOAT x[4]; } *) y),[n] "+&r"(n)
275-
: [y] "a"(y), "m"(*(const struct { FLOAT x[n * 2]; } *) ap0),[ap0] "a"(ap0),
276-
"m"(*(const struct { FLOAT x[n * 2]; } *) ap1),[ap1] "a"(ap1),
277-
"m"(*(const struct { FLOAT x[n * 2]; } *) x),[x] "a"(x),
278-
"m"(*(const struct { FLOAT x[2]; } *) alpha),[alpha] "a"(alpha)
274+
: "+m"(*(FLOAT (*)[4]) y),[n] "+&r"(n)
275+
: [y] "a"(y), "m"(*(const FLOAT (*)[n * 2]) ap0),[ap0] "a"(ap0),
276+
"m"(*(const FLOAT (*)[n * 2]) ap1),[ap1] "a"(ap1),
277+
"m"(*(const FLOAT (*)[n * 2]) x),[x] "a"(x),
278+
"m"(*(const FLOAT (*)[2]) alpha),[alpha] "a"(alpha)
279279
: "cc", "r1", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19", "v20",
280280
"v21", "v22", "v23");
281281
}
@@ -361,10 +361,10 @@ static void cgemv_kernel_4x1(BLASLONG n, FLOAT *ap, FLOAT *x, FLOAT *y,
361361
"vfmasb %%v0,%%v16,%%v18,%%v0\n\t"
362362
"vfmasb %%v0,%%v17,%%v19,%%v0\n\t"
363363
"vsteg %%v0,0(%[y]),0"
364-
: "+m"(*(struct { FLOAT x[2]; } *) y),[n] "+&r"(n)
365-
: [y] "a"(y), "m"(*(const struct { FLOAT x[n * 2]; } *) ap),[ap] "a"(ap),
366-
"m"(*(const struct { FLOAT x[n * 2]; } *) x),[x] "a"(x),
367-
"m"(*(const struct { FLOAT x[2]; } *) alpha),[alpha] "a"(alpha)
364+
: "+m"(*(FLOAT (*)[2]) y),[n] "+&r"(n)
365+
: [y] "a"(y), "m"(*(const FLOAT (*)[n * 2]) ap),[ap] "a"(ap),
366+
"m"(*(const FLOAT (*)[n * 2]) x),[x] "a"(x),
367+
"m"(*(const FLOAT (*)[2]) alpha),[alpha] "a"(alpha)
368368
: "cc", "r1", "v0", "v1", "v2", "v3", "v16", "v17", "v18", "v19");
369369
}
370370

kernel/zarch/crot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ static void crot_kernel_32(BLASLONG n, FLOAT *x, FLOAT *y, FLOAT *c, FLOAT *s) {
169169
"vst %%v23, 240(%%r1,%[y])\n\t"
170170
"agfi %%r1,256\n\t"
171171
"brctg %[n],0b"
172-
: "+m"(*(struct { FLOAT x[n * 2]; } *) x),
173-
"+m"(*(struct { FLOAT x[n * 2]; } *) y),[n] "+&r"(n)
172+
: "+m"(*(FLOAT (*)[n * 2]) x),
173+
"+m"(*(FLOAT (*)[n * 2]) y),[n] "+&r"(n)
174174
: [x] "a"(x),[y] "a"(y),[c] "Q"(*c),[s] "Q"(*s)
175175
: "cc", "r1", "v0", "v1", "v16", "v17", "v18", "v19", "v20", "v21",
176176
"v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",

kernel/zarch/cscal.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ static void cscal_kernel_16(BLASLONG n, FLOAT *alpha, FLOAT *x) {
8080
"vst %%v23,112(%%r1,%[x])\n\t"
8181
"agfi %%r1,128\n\t"
8282
"brctg %[n],0b"
83-
: "+m"(*(struct { FLOAT x[n * 2]; } *) x),[n] "+&r"(n)
84-
: [x] "a"(x), "m"(*(const struct { FLOAT x[2]; } *) alpha),
83+
: "+m"(*(FLOAT (*)[n * 2]) x),[n] "+&r"(n)
84+
: [x] "a"(x), "m"(*(const FLOAT (*)[2]) alpha),
8585
[alpha] "a"(alpha)
8686
: "cc", "r1", "v0", "v1", "v16", "v17", "v18", "v19", "v20", "v21",
8787
"v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
@@ -132,8 +132,8 @@ static void cscal_kernel_16_zero_r(BLASLONG n, FLOAT *alpha, FLOAT *x) {
132132
"vst %%v23,112(%%r1,%[x])\n\t"
133133
"agfi %%r1,128\n\t"
134134
"brctg %[n],0b"
135-
: "+m"(*(struct { FLOAT x[n * 2]; } *) x),[n] "+&r"(n)
136-
: [x] "a"(x), "m"(*(const struct { FLOAT x[2]; } *) alpha),
135+
: "+m"(*(FLOAT (*)[n * 2]) x),[n] "+&r"(n)
136+
: [x] "a"(x), "m"(*(const FLOAT (*)[2]) alpha),
137137
[alpha] "a"(alpha)
138138
: "cc", "r1", "v0", "v16", "v17", "v18", "v19", "v20", "v21", "v22",
139139
"v23");
@@ -171,8 +171,8 @@ static void cscal_kernel_16_zero_i(BLASLONG n, FLOAT *alpha, FLOAT *x) {
171171
"vst %%v23,112(%%r1,%[x])\n\t"
172172
"agfi %%r1,128\n\t"
173173
"brctg %[n],0b"
174-
: "+m"(*(struct { FLOAT x[n * 2]; } *) x),[n] "+&r"(n)
175-
: [x] "a"(x), "m"(*(const struct { FLOAT x[2]; } *) alpha),
174+
: "+m"(*(FLOAT (*)[n * 2]) x),[n] "+&r"(n)
175+
: [x] "a"(x), "m"(*(const FLOAT (*)[2]) alpha),
176176
[alpha] "a"(alpha)
177177
: "cc", "r1", "v0", "v16", "v17", "v18", "v19", "v20", "v21", "v22",
178178
"v23");
@@ -194,7 +194,7 @@ static void cscal_kernel_16_zero(BLASLONG n, FLOAT *x) {
194194
"vst %%v0,112(%%r1,%[x])\n\t"
195195
"agfi %%r1,128\n\t"
196196
"brctg %[n],0b"
197-
: "=m"(*(struct { FLOAT x[n * 2]; } *) x),[n] "+&r"(n)
197+
: "=m"(*(FLOAT (*)[n * 2]) x),[n] "+&r"(n)
198198
: [x] "a"(x)
199199
: "cc", "r1", "v0");
200200
}

0 commit comments

Comments
 (0)