Skip to contentSkip to conversation

Fix build on i686

PATCH In review Matt Turner 2 participants 3 messages Feb 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix build on i686

From: Adam Jackson <[email protected]>

Presumably this only matters for i686 because amd64 implies sse2, but:

BUILDSTDERR: In file included from gen4_vertex.c:34:
BUILDSTDERR: gen4_vertex.c: In function 'emit_vertex':
BUILDSTDERR: sna_render_inline.h:40:26: error: inlining failed in call to always_inline 'vertex_emit_2s': target specific option mismatch
BUILDSTDERR:  static force_inline void vertex_emit_2s(struct sna *sna, int16_t x, int16_t y)
BUILDSTDERR:                           ^~~~~~~~~~~~~~
BUILDSTDERR: gen4_vertex.c:308:25: note: called from here
BUILDSTDERR:  #define OUT_VERTEX(x,y) vertex_emit_2s(sna, x,y) /* XXX assert(!too_large(x, y)); */
BUILDSTDERR:                          ^~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: gen4_vertex.c:360:2: note: in expansion of macro 'OUT_VERTEX'
BUILDSTDERR:   OUT_VERTEX(dstX, dstY);
BUILDSTDERR:   ^~~~~~~~~~

The bug here appears to be that emit_vertex() is declared 'sse2' but vertex_emit_2s is merely always_inline. gcc8 decides that since you said always_inline you need to have explicitly cloned it for every permutation of targets. Merely saying inline seems to do the job of cloning vertex_emit_2s as much as necessary.

So to reiterate: if you say always-inline, it won't, but if you just say maybe inline, it will. Thanks gcc, that's helpful.

---
 src/sna/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/sna/compiler.h +1 -1
index 0f3775ec..c4056913 100644
@@ -32,7 +32,7 @@
 #define likely(expr) (__builtin_expect (!!(expr), 1))
 #define unlikely(expr) (__builtin_expect (!!(expr), 0))
 #define noinline __attribute__((noinline))
-#define force_inline inline __attribute__((always_inline))
+#define force_inline inline
 #define fastcall __attribute__((regparm(3)))
 #define must_check __attribute__((warn_unused_result))
 #define constant __attribute__((const))
Signature · 6 lines
2.19.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting Matt Turner (2019-02-21 03:23:51)

Quoted 16 lines

From: Adam Jackson <[email protected]>

Presumably this only matters for i686 because amd64 implies sse2, but:

BUILDSTDERR: In file included from gen4_vertex.c:34:
BUILDSTDERR: gen4_vertex.c: In function 'emit_vertex':
BUILDSTDERR: sna_render_inline.h:40:26: error: inlining failed in call to always_inline 'vertex_emit_2s': target specific option mismatch
BUILDSTDERR:  static force_inline void vertex_emit_2s(struct sna *sna, int16_t x, int16_t y)
BUILDSTDERR:                           ^~~~~~~~~~~~~~
BUILDSTDERR: gen4_vertex.c:308:25: note: called from here
BUILDSTDERR:  #define OUT_VERTEX(x,y) vertex_emit_2s(sna, x,y) /* XXX assert(!too_large(x, y)); */
BUILDSTDERR:                          ^~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: gen4_vertex.c:360:2: note: in expansion of macro 'OUT_VERTEX'
BUILDSTDERR:   OUT_VERTEX(dstX, dstY);
BUILDSTDERR:   ^~~~~~~~~~
Quoted 8 lines

The bug here appears to be that emit_vertex() is declared 'sse2' but vertex_emit_2s is merely always_inline. gcc8 decides that since you said always_inline you need to have explicitly cloned it for every permutation of targets. Merely saying inline seems to do the job of cloning vertex_emit_2s as much as necessary.

So to reiterate: if you say always-inline, it won't, but if you just say maybe inline, it will. Thanks gcc, that's helpful.

Hasn't this bug occurred in gcc at least twice before? -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 24 lines · Chris Wilson

Quoting Matt Turner (2019-02-21 03:23:51)

Quoted 22 lines

From: Adam Jackson <[email protected]>

Presumably this only matters for i686 because amd64 implies sse2, but:

BUILDSTDERR: In file included from gen4_vertex.c:34:
BUILDSTDERR: gen4_vertex.c: In function 'emit_vertex':
BUILDSTDERR: sna_render_inline.h:40:26: error: inlining failed in call to always_inline 'vertex_emit_2s': target specific option mismatch
BUILDSTDERR:  static force_inline void vertex_emit_2s(struct sna *sna, int16_t x, int16_t y)
BUILDSTDERR:                           ^~~~~~~~~~~~~~
BUILDSTDERR: gen4_vertex.c:308:25: note: called from here
BUILDSTDERR:  #define OUT_VERTEX(x,y) vertex_emit_2s(sna, x,y) /* XXX assert(!too_large(x, y)); */
BUILDSTDERR:                          ^~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: gen4_vertex.c:360:2: note: in expansion of macro 'OUT_VERTEX'
BUILDSTDERR:   OUT_VERTEX(dstX, dstY);
BUILDSTDERR:   ^~~~~~~~~~

The bug here appears to be that emit_vertex() is declared 'sse2' but vertex_emit_2s is merely always_inline. gcc8 decides that since you said always_inline you need to have explicitly cloned it for every permutation of targets. Merely saying inline seems to do the job of cloning vertex_emit_2s as much as necessary.

Quoted 5 lines
Quoted 2 lines

So to reiterate: if you say always-inline, it won't, but if you just say maybe inline, it will. Thanks gcc, that's helpful.

Hasn't this bug occurred in gcc at least twice before? -Chris

Looks like some problems that are at least similar have been reported and fixed in the past. For example:

https://patchwork.kernel.org/patch/6266711/

It appears that Fedora has some other always-inline related patches as well:

https://src.fedoraproject.org/rpms/xorg-x11-drv-intel/blob/master/f/0001-Fix-build-on-F28-and-later.patch
https://src.fedoraproject.org/rpms/xorg-x11-drv-intel/blob/master/f/intel-gcc-pr65873.patch

GCC PR65873 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65873) is titled "Failure to inline always_inline memcpy"...
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx