Open zhongsir1 opened 1 year ago
void s1161(void) {
for (int i = 0; i < LEN_1D-1; ++i) {
if (c[i] < (real_t)0)
b[i] = a[i] + d[i];
else
a[i] = c[i] + d[i];
}
}
.L2:
lsl x1, x0, 3 ; i * 8, double ?
ld1d z0.d, p0/z, [x6, x0, lsl 3] ; d[i]
ld1d z2.d, p0/z, [x7, x0, lsl 3] ; c[i]
add x2, x5, x1 ; &a[i]
fcmlt p2.d, p0/z, z2.d, #0.0 ; if (c[i] < (real_t)0.)
ld1d z1.d, p0/z, [x2] ; a[i]
add x1, x4, x1 ; &b[i]
fadd z1.d, z0.d, z1.d ; b[i] = a[i] + d[i];
fcmge p0.d, p0/z, z2.d, #0.0 ; if (c[i] >= (real_t)0.)
fadd z0.d, z2.d, z0.d ; a[i] = c[i] + d[i];
st1d z1.d, p2, [x1]
st1d z0.d, p0, [x2]
incd x0
whilelo p0.d, w0, w3
b.any .L2
LAA: We can't vectorize because we can't find the array bounds
if.then: %gep.1 = getelementptr inbounds double, ptr %B, i64 %iv
if.else: %gep.2 = getelementptr inbounds double, ptr %C, i64 %iv
loop.latch:%gep.2.sink = phi ptr [ %gep.2, %if.else ], [ %gep.1, %if.then ]
s1161_ptr is a more simple case, https://godbolt.org/z/xaqacGo81, which may require similar extension as the D114480 for PHINode
test: https://godbolt.org/z/7Y6a4EvW9