Re: [PATCH, powerpc], Fix PR48857, pass/return V2DI as other vector types
On Tue, May 03, 2011 at 10:51:51PM -0400, David Edelsohn wrote: What does this do to the ABI? Haven't we now broken the ABI and broken backwards compatibility? In this case, GCC wasn't following the ABI. My patch will have GCC follow the ABI. The XL compiler also follows the ABI. So we have to decide whether to keep the current calling sequence which violates the ABI, or change the compiler to follow the ABI, and break backwards compatiblity. Given the machine doesn't have native VD2Imode operations, except for conversion to/from floating point, and the bitwise operations, I suspect not to many people use the data type. Note, V2DImode was added in GCC 4.5 when the VSX support was added. It was not in the earlier Altivec support. The MODES_TIEABLE_P part of the patch will need to go in to fix PR 48495 (it was in looking at the bug we discovered that the compiler was not following the ABI). -- Michael Meissner, IBM 5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899
Re: [PATCH, powerpc], Fix PR48857, pass/return V2DI as other vector types
On Wed, May 04, 2011 at 11:33:43AM +0200, Richard Guenther wrote: On Wed, May 4, 2011 at 4:51 AM, David Edelsohn dje@gmail.com wrote: What does this do to the ABI? Haven't we now broken the ABI and broken backwards compatibility? It at least looks like so. You need to add appropriate changes.html entries to all branches you apply this patch to. I suppose the new version matches what XLC does? Yes. I will do that if the patch is approved. As I said in my other reply, the patch will make us compatible with XLC. -- Michael Meissner, IBM 5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899
Re: [PATCH, powerpc], Fix PR48857, pass/return V2DI as other vector types
On Tue, May 3, 2011 at 5:27 PM, Michael Meissner meiss...@linux.vnet.ibm.com wrote: When I added VSX support to the powerpc, I overlooked passing and return V2DImode arguments, since the only machine operation that supports V2DI is vector floating point conversion. Consequentally, V2DI types were passed and returned in GPRs instead of the vector registers on power7. This patch fixes that so that V2DImode values are passed and returned like other vector types. I did a bootstrap and make check with no regressions, comparing it to a build without the patch. I also wrote a program that passed and returned every single type, and I compared the assembly ouptut. With the exception of functions that return or are passed V2DI arguments, the code is identical. I tested: -m64 (implies -mabi=altivec) -m32 -mabi=altivec -m32 -mabi=no-altivec (no difference here) Is this patch ok to install? I will also want to install it in the 4.6 and possibly 4.5 trees as well. [gcc] 2011-05-03 Michael Meissner meiss...@linux.vnet.ibm.com PR target/48857 * config/rs6000/rs6000.h (VSX_SCALAR_MODE): Delete. (VSX_MODE): Ditto. (VSX_MOVE_MODE): Ditto. (ALTIVEC_OR_VSX_VECTOR_MODE): New macro, combine all Altivec and VSX vector types. Add V2DImode. (HARD_REGNO_CALLER_SAVE_MODE): Use it instead of ALTIVEC_VECTOR_MODE and VSX_VECTOR_MODE calls. (MODES_TIEABLE_P): Ditto. * config/rs6000/rs6000.c (rs6000_emit_move): Use ALTIVEC_OR_VSX_MODE instead of ALTIVEC_VECTOR_MODE and VSX_VECTOR_MODE. (init_cumulative_args): Ditto. (rs6000_function_arg_boundary): Ditto. (rs6000_function_arg_advance_1): Ditto. (rs6000_function_arg): Ditto. (rs6000_function_ok_for_sibcall): Ditto. (emit_frame_save): Ditto. (rs6000_function_value): Ditto. (rs6000_libcall_value): Ditto. [gcc/testsuite] 2011-05-03 Michael Meissner meiss...@linux.vnet.ibm.com PR target/48857 * gcc.target/powerpc/pr48857.c: New file, make sure V2DI arguments are passed and returned in vector registers. The patch is okay, but please add a comment explaining why the function_value and libcall_value changes are correct. Thanks, David
Re: [PATCH, powerpc], Fix PR48857, pass/return V2DI as other vector types
On Wed, May 4, 2011 at 4:51 AM, David Edelsohn dje@gmail.com wrote: On Tue, May 3, 2011 at 5:27 PM, Michael Meissner meiss...@linux.vnet.ibm.com wrote: When I added VSX support to the powerpc, I overlooked passing and return V2DImode arguments, since the only machine operation that supports V2DI is vector floating point conversion. Consequentally, V2DI types were passed and returned in GPRs instead of the vector registers on power7. This patch fixes that so that V2DImode values are passed and returned like other vector types. I did a bootstrap and make check with no regressions, comparing it to a build without the patch. I also wrote a program that passed and returned every single type, and I compared the assembly ouptut. With the exception of functions that return or are passed V2DI arguments, the code is identical. I tested: -m64 (implies -mabi=altivec) -m32 -mabi=altivec -m32 -mabi=no-altivec (no difference here) Is this patch ok to install? I will also want to install it in the 4.6 and possibly 4.5 trees as well. [gcc] 2011-05-03 Michael Meissner meiss...@linux.vnet.ibm.com PR target/48857 * config/rs6000/rs6000.h (VSX_SCALAR_MODE): Delete. (VSX_MODE): Ditto. (VSX_MOVE_MODE): Ditto. (ALTIVEC_OR_VSX_VECTOR_MODE): New macro, combine all Altivec and VSX vector types. Add V2DImode. (HARD_REGNO_CALLER_SAVE_MODE): Use it instead of ALTIVEC_VECTOR_MODE and VSX_VECTOR_MODE calls. (MODES_TIEABLE_P): Ditto. * config/rs6000/rs6000.c (rs6000_emit_move): Use ALTIVEC_OR_VSX_MODE instead of ALTIVEC_VECTOR_MODE and VSX_VECTOR_MODE. (init_cumulative_args): Ditto. (rs6000_function_arg_boundary): Ditto. (rs6000_function_arg_advance_1): Ditto. (rs6000_function_arg): Ditto. (rs6000_function_ok_for_sibcall): Ditto. (emit_frame_save): Ditto. (rs6000_function_value): Ditto. (rs6000_libcall_value): Ditto. [gcc/testsuite] 2011-05-03 Michael Meissner meiss...@linux.vnet.ibm.com PR target/48857 * gcc.target/powerpc/pr48857.c: New file, make sure V2DI arguments are passed and returned in vector registers. What does this do to the ABI? Haven't we now broken the ABI and broken backwards compatibility? It at least looks like so. You need to add appropriate changes.html entries to all branches you apply this patch to. I suppose the new version matches what XLC does? Richard. - David
Re: [PATCH, powerpc], Fix PR48857, pass/return V2DI as other vector types
On Wed, 2011-05-04 at 11:33 +0200, Richard Guenther wrote: On Wed, May 4, 2011 at 4:51 AM, David Edelsohn dje@gmail.com wrote: On Tue, May 3, 2011 at 5:27 PM, Michael Meissner meiss...@linux.vnet.ibm.com wrote: This patch fixes that so that V2DImode values are passed and returned like other vector types. [snip] What does this do to the ABI? Haven't we now broken the ABI and broken backwards compatibility? It at least looks like so. You need to add appropriate changes.html entries to all branches you apply this patch to. I suppose the new version matches what XLC does? Yes, XLC passes V2DI parameters and return values in Altivec registers as per the ABI, so we're the buggy ones. Peter
Re: [PATCH, powerpc], Fix PR48857, pass/return V2DI as other vector types
On Tue, May 3, 2011 at 5:27 PM, Michael Meissner meiss...@linux.vnet.ibm.com wrote: When I added VSX support to the powerpc, I overlooked passing and return V2DImode arguments, since the only machine operation that supports V2DI is vector floating point conversion. Consequentally, V2DI types were passed and returned in GPRs instead of the vector registers on power7. This patch fixes that so that V2DImode values are passed and returned like other vector types. I did a bootstrap and make check with no regressions, comparing it to a build without the patch. I also wrote a program that passed and returned every single type, and I compared the assembly ouptut. With the exception of functions that return or are passed V2DI arguments, the code is identical. I tested: -m64 (implies -mabi=altivec) -m32 -mabi=altivec -m32 -mabi=no-altivec (no difference here) Is this patch ok to install? I will also want to install it in the 4.6 and possibly 4.5 trees as well. [gcc] 2011-05-03 Michael Meissner meiss...@linux.vnet.ibm.com PR target/48857 * config/rs6000/rs6000.h (VSX_SCALAR_MODE): Delete. (VSX_MODE): Ditto. (VSX_MOVE_MODE): Ditto. (ALTIVEC_OR_VSX_VECTOR_MODE): New macro, combine all Altivec and VSX vector types. Add V2DImode. (HARD_REGNO_CALLER_SAVE_MODE): Use it instead of ALTIVEC_VECTOR_MODE and VSX_VECTOR_MODE calls. (MODES_TIEABLE_P): Ditto. * config/rs6000/rs6000.c (rs6000_emit_move): Use ALTIVEC_OR_VSX_MODE instead of ALTIVEC_VECTOR_MODE and VSX_VECTOR_MODE. (init_cumulative_args): Ditto. (rs6000_function_arg_boundary): Ditto. (rs6000_function_arg_advance_1): Ditto. (rs6000_function_arg): Ditto. (rs6000_function_ok_for_sibcall): Ditto. (emit_frame_save): Ditto. (rs6000_function_value): Ditto. (rs6000_libcall_value): Ditto. [gcc/testsuite] 2011-05-03 Michael Meissner meiss...@linux.vnet.ibm.com PR target/48857 * gcc.target/powerpc/pr48857.c: New file, make sure V2DI arguments are passed and returned in vector registers. What does this do to the ABI? Haven't we now broken the ABI and broken backwards compatibility? - David