The question is in the title :). Trying to understand why there is both an opcode and pre-compiled contract for SHA256. To execute the computation, would people canonically "CALL" into the pre-compiled contract or just use the SHA256 opcode directly?
As far as I'm aware there is no SHA256 opcode. I tried finding one but couldn't find - not listed at least in, for example, this list: https://github.com/crytic/evm-opcodes
Maybe you're mixing it up with sha3 (
keccak256)? It's a different algorithm.
So if you want to use SHA256 you need to call the precompiled contract. But if you're worried about gas costs there are cheaper alternatives around as well, quick googling found at least this: Gas cost of a sha256 hash