raid6/ppc: Fix build for clang
PATCH v2 1/1 raid6/ppc: Fix build for clang
We cannot build these files with clang as it does not allow altivec instructions in assembly when -msoft-float is passed.
Quoted 8 lines · Jinsong Ji
We currently disable Altivec/VSX support when enabling soft-float. So any usage of vector builtins will break.
Enable Altivec/VSX with soft-float may need quite some clean up work, so I guess this is currently a limitation.
Removing -msoft-float will make it work (and we are lucky that no floating point instructions will be generated as well).
This is a workaround until the issue is resolved in clang.
---
v2: fix typo in comment, thanks Jinsong
lib/raid6/Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
lib/raid6/Makefile +15 -0
@@ -18,6 +18,21 @@ quiet_cmd_unroll = UNROLL $@ ifeq ($(CONFIG_ALTIVEC),y) altivec_flags := -maltivec $(call cc-option,-mabi=altivec) + +ifdef CONFIG_CC_IS_CLANG +# clang ppc port does not yet support -maltivec when -msoft-float is +# enabled. A future release of clang will resolve this +# https://bugs.llvm.org/show_bug.cgi?id=31177 +CFLAGS_REMOVE_altivec1.o += -msoft-float +CFLAGS_REMOVE_altivec2.o += -msoft-float +CFLAGS_REMOVE_altivec4.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_vpermxor1.o += -msoft-float +CFLAGS_REMOVE_vpermxor2.o += -msoft-float +CFLAGS_REMOVE_vpermxor4.o += -msoft-float +CFLAGS_REMOVE_vpermxor8.o += -msoft-float +endif endif # The GCC option -ffreestanding is required in order to compile code containing
Signature · 1 line
2.19.1
Quoted 38 lines · Joel Stanley
We cannot build these files with clang as it does not allow altivec instructions in assembly when -msoft-float is passed.
Quoted 8 lines · Jinsong Ji
We currently disable Altivec/VSX support when enabling soft-float. So any usage of vector builtins will break.
Enable Altivec/VSX with soft-float may need quite some clean up work, so I guess this is currently a limitation.
Removing -msoft-float will make it work (and we are lucky that no floating point instructions will be generated as well).
This is a workaround until the issue is resolved in clang.
Signed-off-by Joel Stanley <[email protected]>---
v2: fix typo in comment, thanks Jinsonglib/raid6/Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)lib/raid6/Makefile +5
-0@@ -18,6 +18,21 @@ quiet_cmd_unroll = UNROLL $@ ifeq ($(CONFIG_ALTIVEC),y) altivec_flags := -maltivec $(call cc-option,-mabi=altivec) + +ifdef CONFIG_CC_IS_CLANG +# clang ppc port does not yet support -maltivec when -msoft-float is +# enabled. A future release of clang will resolve this +# https://bugs.llvm.org/show_bug.cgi?id=31177
lib/raid6/Makefile quiet_cmd_unroll = UNROLL $@ · line 35
Quoted 10 lines
lib/raid6/Makefile +10
-0+CFLAGS_REMOVE_altivec1.o += -msoft-float +CFLAGS_REMOVE_altivec2.o += -msoft-float +CFLAGS_REMOVE_altivec4.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_vpermxor1.o += -msoft-float +CFLAGS_REMOVE_vpermxor2.o += -msoft-float +CFLAGS_REMOVE_vpermxor4.o += -msoft-float +CFLAGS_REMOVE_vpermxor8.o += -msoft-float +endif
Hi Joel, thanks for this patch! My same thoughts about CONFIG_CC_IS_CLANG vs cc-option from
https://lists.ozlabs.org/pipermail/linuxppc-dev/2018-November/180939.html
apply here as well. I don't feel strongly about either though. What are your thoughts?
Quoted 6 lines
lib/raid6/Makefile +0
-1endif # The GCC option -ffreestanding is required in order to compile code containing --2.19.1
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 48 lines · Nick Desaulniers
Quoted 46 lines · Joel Stanley
We cannot build these files with clang as it does not allow altivec instructions in assembly when -msoft-float is passed.
Quoted 8 lines · Jinsong Ji
We currently disable Altivec/VSX support when enabling soft-float. So any usage of vector builtins will break.
Enable Altivec/VSX with soft-float may need quite some clean up work, so I guess this is currently a limitation.
Removing -msoft-float will make it work (and we are lucky that no floating point instructions will be generated as well).
This is a workaround until the issue is resolved in clang.
Signed-off-by Joel Stanley <[email protected]>---
v2: fix typo in comment, thanks Jinsonglib/raid6/Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)lib/raid6/Makefile +13
-0@@ -18,6 +18,21 @@ quiet_cmd_unroll = UNROLL $@ ifeq ($(CONFIG_ALTIVEC),y) altivec_flags := -maltivec $(call cc-option,-mabi=altivec) + +ifdef CONFIG_CC_IS_CLANG +# clang ppc port does not yet support -maltivec when -msoft-float is +# enabled. A future release of clang will resolve this +# https://bugs.llvm.org/show_bug.cgi?id=31177 +CFLAGS_REMOVE_altivec1.o += -msoft-float +CFLAGS_REMOVE_altivec2.o += -msoft-float +CFLAGS_REMOVE_altivec4.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_vpermxor1.o += -msoft-float +CFLAGS_REMOVE_vpermxor2.o += -msoft-float +CFLAGS_REMOVE_vpermxor4.o += -msoft-float
Quoted 8 lines
lib/raid6/Makefile quiet_cmd_unroll = UNROLL $@ · line 35
Quoted 2 lines
lib/raid6/Makefile +2
-0+CFLAGS_REMOVE_vpermxor8.o += -msoft-float +endifHi Joel, thanks for this patch! My same thoughts about
CONFIG_CC_IS_CLANGvs cc-option from
https://lists.ozlabs.org/pipermail/linuxppc-dev/2018-November/180939.html
apply here as well. I don't feel strongly about either though. What are your thoughts?
I'm not sure that we can test for this one with cc-option. The result of having -maltivec with -msoft-float is a error about the internals of clang, which isn't something that kbuild is set up to test for.
When clang is fixed to allow this combination we will still build this code in the same way, so in that sense it fails "open".
Cheers,
Joel
Quoted 59 lines · Joel Stanley
Quoted 48 lines · Nick Desaulniers
Quoted 46 lines · Joel Stanley
We cannot build these files with clang as it does not allow altivec instructions in assembly when -msoft-float is passed.
Quoted 8 lines · Jinsong Ji
We currently disable Altivec/VSX support when enabling soft-float. So any usage of vector builtins will break.
Enable Altivec/VSX with soft-float may need quite some clean up work, so I guess this is currently a limitation.
Removing -msoft-float will make it work (and we are lucky that no floating point instructions will be generated as well).
This is a workaround until the issue is resolved in clang.
Signed-off-by Joel Stanley <[email protected]>---
v2: fix typo in comment, thanks Jinsonglib/raid6/Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)lib/raid6/Makefile +13
-0@@ -18,6 +18,21 @@ quiet_cmd_unroll = UNROLL $@ ifeq ($(CONFIG_ALTIVEC),y) altivec_flags := -maltivec $(call cc-option,-mabi=altivec) + +ifdef CONFIG_CC_IS_CLANG +# clang ppc port does not yet support -maltivec when -msoft-float is +# enabled. A future release of clang will resolve this +# https://bugs.llvm.org/show_bug.cgi?id=31177 +CFLAGS_REMOVE_altivec1.o += -msoft-float +CFLAGS_REMOVE_altivec2.o += -msoft-float +CFLAGS_REMOVE_altivec4.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_vpermxor1.o += -msoft-float +CFLAGS_REMOVE_vpermxor2.o += -msoft-float +CFLAGS_REMOVE_vpermxor4.o += -msoft-floatQuoted 8 lines
lib/raid6/Makefile quiet_cmd_unroll = UNROLL $@ · line 35
Quoted 2 lines
lib/raid6/Makefile +2
-0+CFLAGS_REMOVE_vpermxor8.o += -msoft-float +endifHi Joel, thanks for this patch! My same thoughts about
CONFIG_CC_IS_CLANGvs cc-option from
https://lists.ozlabs.org/pipermail/linuxppc-dev/2018-November/180939.html
apply here as well. I don't feel strongly about either though. What are your thoughts?
Quoted 3 lines
I'm not sure that we can test for this one with cc-option. The result of having -maltivec with -msoft-float is a error about the internals of clang, which isn't something that kbuild is set up to test for.
As in clang itself crashes, and cc-option/kbuild can't handle that gracefully?
Quoted 7 lines
When clang is fixed to allow this combination we will still build this code in the same way, so in that sense it fails "open".
Cheers,
Joel
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 21 lines · Nick Desaulniers
Quoted 21 lines
Quoted 20 lines
Quoted 4 lines
lib/raid6/Makefile +4
-0+ifdef CONFIG_CC_IS_CLANG +# clang ppc port does not yet support -maltivec when -msoft-float is +# enabled. A future release of clang will resolve this +# https://bugs.llvm.org/show_bug.cgi?id=31177lib/raid6/Makefile quiet_cmd_unroll = UNROLL $@ · line 35
Quoted 10 lines
lib/raid6/Makefile +10
-0+CFLAGS_REMOVE_altivec1.o += -msoft-float +CFLAGS_REMOVE_altivec2.o += -msoft-float +CFLAGS_REMOVE_altivec4.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_vpermxor1.o += -msoft-float +CFLAGS_REMOVE_vpermxor2.o += -msoft-float +CFLAGS_REMOVE_vpermxor4.o += -msoft-float +CFLAGS_REMOVE_vpermxor8.o += -msoft-float +endifHi Joel, thanks for this patch! My same thoughts about
CONFIG_CC_IS_CLANGvs cc-option from
https://lists.ozlabs.org/pipermail/linuxppc-dev/2018-November/180939.html
apply here as well. I don't feel strongly about either though. What are your thoughts?
Quoted 5 lines
Quoted 3 lines
I'm not sure that we can test for this one with cc-option. The result of having -maltivec with -msoft-float is a error about the internals of clang, which isn't something that kbuild is set up to test for.
As in clang itself crashes, and cc-option/kbuild can't handle that gracefully?
The developer gets something like this:
SplitVectorResult #0: t196: v16i8 = llvm.ppc.altivec.vcmpgtsb TargetConstant:i64<4823>, t146, t195
fatal error: error in backend: Do not know how to split the result of this operator!
clang-8: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Quoted 5 lines
Quoted 5 lines
When clang is fixed to allow this combination we will still build this code in the same way, so in that sense it fails "open".
Nick Desaulniers
Reviewed-byQuoted 29 lines · Joel Stanley
Quoted 21 lines · Nick Desaulniers
Quoted 21 lines
Quoted 20 lines
Quoted 4 lines
lib/raid6/Makefile +4
-0+ifdef CONFIG_CC_IS_CLANG +# clang ppc port does not yet support -maltivec when -msoft-float is +# enabled. A future release of clang will resolve this +# https://bugs.llvm.org/show_bug.cgi?id=31177lib/raid6/Makefile quiet_cmd_unroll = UNROLL $@ · line 35
Quoted 10 lines
lib/raid6/Makefile +10
-0+CFLAGS_REMOVE_altivec1.o += -msoft-float +CFLAGS_REMOVE_altivec2.o += -msoft-float +CFLAGS_REMOVE_altivec4.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_altivec8.o += -msoft-float +CFLAGS_REMOVE_vpermxor1.o += -msoft-float +CFLAGS_REMOVE_vpermxor2.o += -msoft-float +CFLAGS_REMOVE_vpermxor4.o += -msoft-float +CFLAGS_REMOVE_vpermxor8.o += -msoft-float +endifHi Joel, thanks for this patch! My same thoughts about
CONFIG_CC_IS_CLANGvs cc-option from
https://lists.ozlabs.org/pipermail/linuxppc-dev/2018-November/180939.html
apply here as well. I don't feel strongly about either though. What are your thoughts?Quoted 5 lines
Quoted 3 lines
I'm not sure that we can test for this one with cc-option. The result of having -maltivec with -msoft-float is a error about the internals of clang, which isn't something that kbuild is set up to test for.
As in clang itself crashes, and cc-option/kbuild can't handle that gracefully?
Quoted 14 lines
The developer gets something like this:
SplitVectorResult #0: t196: v16i8 = llvm.ppc.altivec.vcmpgtsb TargetConstant:i64<4823>, t146, t195
fatal error: error in backend: Do not know how to split the result of this operator!
clang-8: error: clang frontend command failed with exit code 70 (use -v to see invocation)Quoted 5 lines
Quoted 5 lines
When clang is fixed to allow this combination we will still build this code in the same way, so in that sense it fails "open".
Eek, that means cc-option is not hardened against flags that crash the compiler (misbehaving compiler). We'll have to get some version check in place should we ever want to use those flags for these object files, but for now:
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 8 lines · Joel Stanley
Quoted 6 lines · Nick Desaulniers
Quoted 4 lines
Quoted 4 lines
lib/raid6/Makefile quiet_cmd_unroll = UNROLL $@ · line 25
Quoted 4 lines
lib/raid6/Makefile +4
-0+ifdef CONFIG_CC_IS_CLANG +# clang ppc port does not yet support -maltivec when -msoft-float is +# enabled. A future release of clang will resolve this +# https://bugs.llvm.org/show_bug.cgi?id=31177As in clang itself crashes, and cc-option/kbuild can't handle that gracefully?
Quoted 8 lines
The developer gets something like this:
SplitVectorResult #0: t196: v16i8 = llvm.ppc.altivec.vcmpgtsb TargetConstant:i64<4823>, t146, t195
fatal error: error in backend: Do not know how to split the result of this operator!
clang-8: error: clang frontend command failed with exit code 70 (use -v to see invocation)
-msoft-float simply means not to use FPRs, and nothing more or less, so that is a pretty interesting failure (will probably turn out to be a typo or something else boring, but it is fun while it lasts).
Segher
Michael Ellerman
AppliedQuoted 13 lines · Joel Stanley
We cannot build these files with clang as it does not allow altivec instructions in assembly when -msoft-float is passed.
Quoted 8 lines · Jinsong Ji
We currently disable Altivec/VSX support when enabling soft-float. So any usage of vector builtins will break.
Enable Altivec/VSX with soft-float may need quite some clean up work, so I guess this is currently a limitation.
Removing -msoft-float will make it work (and we are lucky that no floating point instructions will be generated as well).
Quoted 6 lines
This is a workaround until the issue is resolved in clang.
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/e213574a449f7a57d4202c1869bbc7
cheers