Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM.opcode mismatch with opcode type #500

Closed
1m1-github opened this issue Jan 12, 2025 · 1 comment
Closed

LLVM.opcode mismatch with opcode type #500

1m1-github opened this issue Jan 12, 2025 · 1 comment

Comments

@1m1-github
Copy link

from the julia code

function ApprovalProgram(a::UInt64)::UInt64
    if a % UInt64(2) == UInt64(0) return UInt64(1) end
    return UInt64(0)
end

code_llvm gives as the 1st instruction: %0 = and i64 %"a::UInt64", 1

which inspected using LLVM.jl (instruction = collect(LLVM.instructions(bb))[1])

gives typeof(instruction) == LLVM.AndInst which seems like the and opcode of LLVM,

but LLVM.opcode(instruction) gives LLVMAnd::LLVMOpcode = 0x00000017

and 0x17=23 in https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/IR/Instruction.def corresponds to srem in line 157

Why this mismatch?

@1m1-github
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant