https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70010

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
I think I see the problem.  The no-vsx function needs to be inlined into a
function that itself uses VSX, like in this test case.  I don't know if this is
supposed to work.  I vaguely recall inlining and target (amnd other similar)
attributes not meshing together.

$ cat ~/tmp/t.c && /build/gcc-5.x/gcc/xgcc -B/build/gcc-5.x/gcc -O2 -Wall
-Wextra -flto -fpic -maltivec -mcpu=power8 -mno-allow-movmisalign -shared -o
t.so ~/tmp/t.c && objdump -d t.so | sed -n "/<\.call_vadd_no_vsx>:/,/^$/p"
#define vector     __attribute__ ((vector_size (16)))
#define no_altivec __attribute__((__target__("no-altivec")))
#define no_vsx     __attribute__((__target__("no-vsx")))

vector int a, b, c;
vector int d, e, f;

static void no_vsx vadd_no_vsx (void) {
    c = a + b;
}

void call_vadd_no_vsx (void) {
    vadd_no_vsx ();
    f = d + e;
}
00000000000009f0 <.call_vadd_no_vsx>:
 9f0:   60 00 00 00     nop
 9f4:   e9 42 80 50     ld      r10,-32688(r2)
 9f8:   60 00 00 00     nop
 9fc:   e9 22 80 58     ld      r9,-32680(r2)
 a00:   60 00 00 00     nop
 a04:   e8 e2 80 38     ld      r7,-32712(r2)
 a08:   60 00 00 00     nop
 a0c:   e9 02 80 40     ld      r8,-32704(r2)
 a10:   7c 00 56 19     lxvw4x  vs32,0,r10
 a14:   7d a0 4e 19     lxvw4x  vs45,0,r9
 a18:   60 00 00 00     nop
 a1c:   e9 42 80 30     ld      r10,-32720(r2)
 a20:   60 00 00 00     nop
 a24:   e9 22 80 48     ld      r9,-32696(r2)
 a28:   7c 20 3e 19     lxvw4x  vs33,0,r7
 a2c:   7d 80 46 19     lxvw4x  vs44,0,r8
 a30:   10 00 68 80     vadduwm v0,v0,v13
 a34:   10 21 60 80     vadduwm v1,v1,v12
 a38:   7c 00 4f 19     stxvw4x vs32,0,r9
 a3c:   7c 20 57 19     stxvw4x vs33,0,r10
 a40:   4e 80 00 20     blr
        ...
 a54:   00 01 f6 a0     .long 0x1f6a0

Reply via email to