Skip to content

Commit 7038c1e

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 292c514 + 44c5956 commit 7038c1e

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

test/codegen/floats.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func Mul2(f float64) float64 {
1919
// amd64:"ADDSD",-"MULSD"
2020
// arm/7:"ADDD",-"MULD"
2121
// arm64:"FADDD",-"FMULD"
22+
// loong64:"ADDD",-"MULD"
2223
// ppc64x:"FADD",-"FMUL"
2324
// riscv64:"FADDD",-"FMULD"
2425
return f * 2.0
@@ -29,6 +30,7 @@ func DivPow2(f1, f2, f3 float64) (float64, float64, float64) {
2930
// amd64:"MULSD",-"DIVSD"
3031
// arm/7:"MULD",-"DIVD"
3132
// arm64:"FMULD",-"FDIVD"
33+
// loong64:"MULD",-"DIVD"
3234
// ppc64x:"FMUL",-"FDIV"
3335
// riscv64:"FMULD",-"FDIVD"
3436
x := f1 / 16.0
@@ -37,6 +39,7 @@ func DivPow2(f1, f2, f3 float64) (float64, float64, float64) {
3739
// amd64:"MULSD",-"DIVSD"
3840
// arm/7:"MULD",-"DIVD"
3941
// arm64:"FMULD",-"FDIVD"
42+
// loong64:"MULD",-"DIVD"
4043
// ppc64x:"FMUL",-"FDIVD"
4144
// riscv64:"FMULD",-"FDIVD"
4245
y := f2 / 0.125
@@ -45,6 +48,7 @@ func DivPow2(f1, f2, f3 float64) (float64, float64, float64) {
4548
// amd64:"ADDSD",-"DIVSD",-"MULSD"
4649
// arm/7:"ADDD",-"MULD",-"DIVD"
4750
// arm64:"FADDD",-"FMULD",-"FDIVD"
51+
// loong64:"ADDD",-"MULD",-"DIVD"
4852
// ppc64x:"FADD",-"FMUL",-"FDIV"
4953
// riscv64:"FADDD",-"FMULD",-"FDIVD"
5054
z := f3 / 0.5

test/codegen/math.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func sqrt(x float64) float64 {
5353
// 386/sse2:"SQRTSD" 386/softfloat:-"SQRTD"
5454
// arm64:"FSQRTD"
5555
// arm/7:"SQRTD"
56+
// loong64:"SQRTD"
5657
// mips/hardfloat:"SQRTD" mips/softfloat:-"SQRTD"
5758
// mips64/hardfloat:"SQRTD" mips64/softfloat:-"SQRTD"
5859
// wasm:"F64Sqrt"
@@ -66,6 +67,7 @@ func sqrt32(x float32) float32 {
6667
// 386/sse2:"SQRTSS" 386/softfloat:-"SQRTS"
6768
// arm64:"FSQRTS"
6869
// arm/7:"SQRTF"
70+
// loong64:"SQRTF"
6971
// mips/hardfloat:"SQRTF" mips/softfloat:-"SQRTF"
7072
// mips64/hardfloat:"SQRTF" mips64/softfloat:-"SQRTF"
7173
// wasm:"F32Sqrt"
@@ -78,6 +80,7 @@ func sqrt32(x float32) float32 {
7880
func abs(x, y float64) {
7981
// amd64:"BTRQ\t[$]63"
8082
// arm64:"FABSD\t"
83+
// loong64:"ABSD\t"
8184
// s390x:"LPDFR\t",-"MOVD\t" (no integer load/store)
8285
// ppc64x:"FABS\t"
8386
// riscv64:"FABSD\t"
@@ -102,13 +105,15 @@ func abs32(x float32) float32 {
102105
// Check that it's using integer registers
103106
func copysign(a, b, c float64) {
104107
// amd64:"BTRQ\t[$]63","ANDQ","ORQ"
108+
// loong64:"FCOPYSGD"
105109
// s390x:"CPSDR",-"MOVD" (no integer load/store)
106110
// ppc64x:"FCPSGN"
107111
// riscv64:"FSGNJD"
108112
// wasm:"F64Copysign"
109113
sink64[0] = math.Copysign(a, b)
110114

111115
// amd64:"BTSQ\t[$]63"
116+
// loong64:"FCOPYSGD"
112117
// s390x:"LNDFR\t",-"MOVD\t" (no integer load/store)
113118
// ppc64x:"FCPSGN"
114119
// riscv64:"FSGNJD"
@@ -121,6 +126,7 @@ func copysign(a, b, c float64) {
121126
sink64[2] = math.Float64frombits(math.Float64bits(a) | 1<<63)
122127

123128
// amd64:"ANDQ","ORQ"
129+
// loong64:"FCOPYSGD"
124130
// s390x:"CPSDR\t",-"MOVD\t" (no integer load/store)
125131
// ppc64x:"FCPSGN"
126132
// riscv64:"FSGNJD"

test/codegen/mathbits.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@ func Sub64MPanicOnOverflowGT(a, b [2]uint64) [2]uint64 {
938938
func Mul(x, y uint) (hi, lo uint) {
939939
// amd64:"MULQ"
940940
// arm64:"UMULH","MUL"
941+
// loong64:"MULV","MULHVU"
941942
// ppc64x:"MULHDU","MULLD"
942943
// s390x:"MLGR"
943944
// mips64: "MULVU"
@@ -948,6 +949,7 @@ func Mul(x, y uint) (hi, lo uint) {
948949
func Mul64(x, y uint64) (hi, lo uint64) {
949950
// amd64:"MULQ"
950951
// arm64:"UMULH","MUL"
952+
// loong64:"MULV","MULHVU"
951953
// ppc64x:"MULHDU","MULLD"
952954
// s390x:"MLGR"
953955
// mips64: "MULVU"
@@ -957,13 +959,15 @@ func Mul64(x, y uint64) (hi, lo uint64) {
957959

958960
func Mul64HiOnly(x, y uint64) uint64 {
959961
// arm64:"UMULH",-"MUL"
962+
// loong64:"MULHVU",-"MULV"
960963
// riscv64:"MULHU",-"MUL\t"
961964
hi, _ := bits.Mul64(x, y)
962965
return hi
963966
}
964967

965968
func Mul64LoOnly(x, y uint64) uint64 {
966969
// arm64:"MUL",-"UMULH"
970+
// loong64:"MULV",-"MULHVU"
967971
// riscv64:"MUL\t",-"MULHU"
968972
_, lo := bits.Mul64(x, y)
969973
return lo
@@ -972,6 +976,7 @@ func Mul64LoOnly(x, y uint64) uint64 {
972976
func Mul64Const() (uint64, uint64) {
973977
// 7133701809754865664 == 99<<56
974978
// arm64:"MOVD\t[$]7133701809754865664, R1", "MOVD\t[$]88, R0"
979+
// loong64:"MOVV\t[$]88, R4","MOVV\t[$]7133701809754865664, R5",-"MUL"
975980
return bits.Mul64(99+88<<8, 1<<56)
976981
}
977982

0 commit comments

Comments
 (0)