This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MIPS: Disabling "div" traps in GAS


"Marshall B. Rogers" <mbr@64.vg> writes:
> I've set "nomacro" (judging by the source code, I guess "nomacro" only
> turns on warnings?)

Correct.

> and "noat" but GAS expands "div" instructions into
> a division-by-zero check. I've tried passing -mno-check-zero-division
> to GCC, but it didn't help. The source file I'm assembling is a
> disassembly of a binary which already has division-by-zero checks, if
> that has anything to do with it. I'm using binutils 2.20.

I am not sure I understand your question (e.g. is this C you're
compiling, inline assembly or assembly?).  In the *assembler* we make
the decision whether to treat div as macro (and add the divide-by-zero
check) or as the the machine insn itself based on the destination
operand.  In order to assemble into the machine insn without the check
use the three register-operand version with zero as the destination
register.

> I also noticed that in objdump -d the "DIV" instruction is shown with
> 3 operands, whereas it is only supposed to have two (see manual).
>>     a30:       0153001a        div     zero,t2,s3

Right, this is to be consistent with how we expect the same thing on
input to the assembler.

Adam


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]