diff options
| author | Junyang Shao <shaojunyang@google.com> | 2025-09-19 18:38:25 +0000 |
|---|---|---|
| committer | Junyang Shao <shaojunyang@google.com> | 2025-09-22 16:19:02 -0700 |
| commit | 63a09d6d3d68acedfc9e5fd2daf6febc35aca1d6 (patch) | |
| tree | bb70ba4f429251c384646298a6fdb335c7a09ac1 /test | |
| parent | 2ca96d218d2cbaad99ba807b3bddd90bbf6a5ba8 (diff) | |
| download | go-63a09d6d3d68acedfc9e5fd2daf6febc35aca1d6.tar.xz | |
[dev.simd] cmd/compile: fix SIMD const rematerialization condition
This CL fixes a condition for the previous fix CL 704056.
Change-Id: I1f1f8c6f72870403cb3dff14755c43385dc0c933
Reviewed-on: https://go-review.googlesource.com/c/go/+/705499
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/simd/bug2.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/simd/bug2.go b/test/simd/bug2.go index 2d2094b5a4..5b7a21176a 100644 --- a/test/simd/bug2.go +++ b/test/simd/bug2.go @@ -24,3 +24,46 @@ func PackComplex(b bool) { } } } + +func PackComplex2(x0 uint16, src [][4]float32, b, b2 bool) { + var out [][4]byte + if b2 { + for y := range x0 { + row := out[:x0] + for x := range row { + px := &src[y] + if b { + var indices [4]uint32 + fu := simd.LoadFloat32x4(px).AsUint32x4() + fu.ShiftAllRight(0).Store(nil) + entry := simd.LoadUint32x4(&[4]uint32{ + toSrgbTable[indices[0]], + }) + var res [4]uint32 + entry.ShiftAllRight(19).Store(nil) + row[x] = [4]uint8{ + uint8(res[0]), + uint8(res[1]), + uint8(res[2]), + } + } else { + row[x] = [4]uint8{ + float32ToSrgb8(0), + float32ToSrgb8(1), + float32ToSrgb8(2), + } + } + } + out = out[len(out):] + } + } +} + +var toSrgbTable = [4]uint32{} + +func float32ToSrgb8(f float32) uint8 { + f = min(0, f) + fu := uint32(f) + entry := toSrgbTable[fu] + return uint8(entry * fu) +} |
