Module Name: src Committed By: uwe Date: Mon Sep 11 12:00:45 UTC 2023
Modified Files: src/lib/libarch/sparc/v8: sparc_v8.S Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libarch/sparc/v8/sparc_v8.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libarch/sparc/v8/sparc_v8.S diff -u src/lib/libarch/sparc/v8/sparc_v8.S:1.2 src/lib/libarch/sparc/v8/sparc_v8.S:1.3 --- src/lib/libarch/sparc/v8/sparc_v8.S:1.2 Tue Sep 22 13:27:13 2015 +++ src/lib/libarch/sparc/v8/sparc_v8.S Mon Sep 11 12:00:45 2023 @@ -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