sparc_v8.S: fix v8 .mul/.umul versions to conform to psABI

Both .mul and .umul are defined to return the most significant 32 bits
of the result in %o1, but v8 multiplication instructions put them in
%y.  Move them to %o1.  Nothing in the gcc generated code depends on
this, but hand-written assembly can rely on this and e.g. Self does.
thorpej-altq-separation
uwe 2023-09-11 12:00:45 +00:00
parent 8b4bc2e26f
commit 01a19e2f71
1 changed files with 26 additions and 9 deletions

View File

@ -6,28 +6,45 @@
.file "sparc_v8.S"
.section ".text"
/*--- .umul ---*/
/*
* unsigned .umul(unsigned a, unsigned b)
*
* This function computes a * b with unsigned integer
* multiplication. When .umul returns, the caller's register %o0
* contains the least significant 32 bits of the 64-bit result;
* register %o1 holds the most significant 32 bits of the result.
* Upon return, the integer condition codes and registers %o2
* through %o5 have unspecified values.
*/
.align 4
.global .umul
.type .umul,@function
.umul:
!#PROLOGUE# 0
!#PROLOGUE# 1
umul %o0, %o1, %o0
retl
umul %o0, %o1, %o0
rd %y, %o1
.LLfe1:
.size .umul,.LLfe1-.umul
/*--- .mul ---*/
/*
* int .mul(int a, int b)
*
* This function computes a * b with signed integer
* multiplication. When .mul returns, the caller's register %o0
* contains the least significant 32 bits of the 64-bit result;
* register %o1 holds the most significant 32 bits of the result.
* Upon return, the integer condition codes and registers %o2
* through %o5 have unspecified values.
*/
.align 4
.global .mul
.type .mul,@function
.mul:
!#PROLOGUE# 0
!#PROLOGUE# 1
smul %o0, %o1, %o0
retl
smul %o0, %o1, %o0
rd %y, %o1
.LLfe2:
.size .mul,.LLfe2-.mul