package go-hex not working due to an inline asm instruction
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start with the reported github.com/tmthrgd/go-hex/hex_decode_amd64.s file and the decodeAVX function, then reproduce the minimal program with llgo v1.0.3 on linux/amd64. Investigate how the POR instruction is translated; done means the package builds and the example runs successfully under llgo without the unsupported-instruction error.
Written by the indexing model from the issue text.
Description
Consider the following minimal program for testing the package github.com/tmthrgd/go-hex under llgo [the reason why I 've got into this issue is that this package is used internally by bun orm]
package main
import (
"fmt"
"log"
"github.com/tmthrgd/go-hex"
)
func main() {
// Original data in bytes
originalData := []byte("Hello, Go Hex!")
fmt.Printf("Original data (bytes): %v\n", originalData)
fmt.Printf("Original data (string): %s\n\n", string(originalData))
// 1. Encode to Hexadecimal (Lowercase)
encodedStr := hex.EncodeToString(originalData)
fmt.Printf("Hexadecimal (Lowercase): %s\n", encodedStr)
// 2. Decode from Hexadecimal
decodedData, err := hex.DecodeString(encodedStr)
if err != nil {
log.Fatalf("Error decoding: %v", err)
}
fmt.Printf("Decoded (string): %s\n", string(decodedData))
}
Under go 1.27.0 program works as follows
$go build
[pablo@minipc hex]$ ./test-go-hex
Original data (bytes): [72 101 108 108 111 44 32 71 111 32 72 101 120 33]
Original data (string): Hello, Go Hex!
Hexadecimal (Lowercase): 48656c6c6f2c20476f2048657821
Decoded (string): Hello, Go Hex!
Now using llgo v1.0.3 linux/amd64 I've got
$ llgo build
github.com/tmthrgd/go-hex: translate /home/pablo/gopath/pkg/mod/github.com/tmthrgd/go-hex@v0.0.0-20190904060850-447a3041c3bc/hex_decode_amd64.s: github.com/tmthrgd/go-hex: translate /home/pablo/gopath/pkg/mod/github.com/tmthrgd/go-hex@v0.0.0-20190904060850-447a3041c3bc/hex_decode_amd64.s: github.com/tmthrgd/go-hex.decodeAVX: "POR decodeToLower<>(SB), X0": amd64: unsupported instruction POR
- Dominant language
- LLVM
- Stars
- 758
- Forks
- 49
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 138
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from xgo-dev/llgo
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Similar issues
-
mlir
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
llvm/llvm-project#224908 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
area-CodeGen-coreclr untriaged
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
secondlife/sl-vscode-plugin#147 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
objectionary/phie#149 ·