OSDN Git Service

ARM lowering integer divide and remainder, with div by 0 checks.
authorJan Voung <jvoung@chromium.org>
Tue, 30 Jun 2015 18:03:15 +0000 (11:03 -0700)
committerJan Voung <jvoung@chromium.org>
Tue, 30 Jun 2015 18:03:15 +0000 (11:03 -0700)
commit6ec369ebee62c3aab7fb7334d0bf3fac3a7133e5
tree128f467ab20fb5cabaac502a2b336c993a872689
parent6c17dd8cb9b7b62b872ce4fd49d61b5f646f4899
ARM lowering integer divide and remainder, with div by 0 checks.

ARM normally just returns 0 when dividing by 0 with the
software and hw implementations, which is different from
what X86 does. So, for NaCl, we've modified LLVM to trap
by inserting explicit 0 checks.

Uses -mattr=hwdiv-arm attribute to decide if 32-bit
sdiv/udiv are supported.

Also lower the unreachable-inst to a trap-inst, since we
need a trap instruction for divide by 0 anyway.

Misc: fix switch test under MINIMAL=1, since ARM requires
allow_dump for filetype=asm.
Random clang-format changes...

TODO: check via cross tests

BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1214693004.
runtime/szrt.c
src/IceInstARM32.cpp
src/IceInstARM32.h
src/IceInstX8632.cpp
src/IceTargetLowering.h
src/IceTargetLoweringARM32.cpp
src/IceTargetLoweringARM32.h
tests_lit/llvm2ice_tests/64bit.pnacl.ll
tests_lit/llvm2ice_tests/arith.ll
tests_lit/llvm2ice_tests/switch-opt.ll
tests_lit/llvm2ice_tests/unreachable.ll