1. 07 Aug, 2014 2 commits
    • Subzero: Use scalar arithmetic when no vector instruction exists. · afeaee41
      Matt Wala authored
      Implement scalarizeArithmetic() which extracts the components of the
      input vectors, performs the operation with scalar instructions, and
      builds the output vector component by component.
      
      Fix the lowering of sdiv and srem.  These were previously emitting a
      wrong instruction (cdq) for i8 and i16 inputs (needing cbw, cwd).
      
      In the test_arith crosstest, mask the inputs to vector shift
      operations to ensure that the shifts are in range.  Otherwise the
      Subzero output is not identical to the llc output in some (undefined)
      cases.
      
      BUG=none
      R=stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/443203003
    • Subzero: A few fixes toward running larger programs. · 206833c6
      Jim Stichnoth authored
      1. Add 'llvm2ice -disable-globals' to disable Subzero translation of
      global initializers, since full support isn't yet implemented.
      
      2. Change the names of intra-block branch target labels to avoid
      collisions with basic block labels.
      
      3. Fix lowering of "br i1 <constant>, label ...", which was producing
      invalid instructions like "cmp 1, 0".
      
      4. Fix the "make format-diff" operation, which was diffing against the wrong target.
      
      BUG= none
      R=wala@chromium.org
      
      Review URL: https://codereview.chromium.org/449093002
  2. 05 Aug, 2014 1 commit
    • Subzero: Fix and clean up some cross tests. · 7da431b5
      Jim Stichnoth authored
      1. It turns out that the crosstest scripts mix different versions of
      clang - build_pnacl_ir.py uses pnacl-clang from the NaCl SDK for the
      tests, while crosstest.py uses clang/clang++ from LLVM_BIN_PATH for
      the driver.  The SDK has been updated to use a different version of
      the standard library, and now there is a mismatch as to whether int8_t
      is typedef'd to 'char' or 'signed char', leading to name mangling
      mismatches.  (char, signed char, and unsigned char are distinct
      types.)  We deal with this by using myint8_t which is explicitly
      defined as signed char.
      
      2. Some ugly function pointer casting in test_arith_main.cpp is fixed/removed.
      
      3. std::endl is replaced with "\n".
      
      4. License text is added to tests that were touched by the above items.
      
      BUG= none
      R=wala@chromium.org
      
      Review URL: https://codereview.chromium.org/435353002
  3. 31 Jul, 2014 1 commit
    • Subzero: Fix some issues related to legalization and undef handling. · e377767c
      Matt Wala authored
      1. Much of the lowering code for vector operations was not properly
      checking that the input operand was in a register or memory. This
      problem could be exhibited by passing undef values as inputs.
      
      => Change the vector legalization code to legalize input operands to
      register or memory before producing instructions that use the
      operands. Also, append a suffix to the variable names in the vector
      legalization code to clarify the legalization status of the values.
      
      2. Undef values should never be emitted directly. Rather, they should
      have been appropriately legalized to a zero value.
      
      => To enforce this, make ConstantUndef::emit() issue an error
      message. Do this in the x86 backend, as other backends may decide to
      treat undef values differently.
      
      3. The regalloc_evict_non_overlap test was loading from an undef
      pointer. Subzero was not handling this correctly (the undef pointer was
      being emitted without being legalized), but it does not have to handle
      this case since PNaCl IR disallows undef pointers.
      
      => Fix the regalloc_evict_non_overlap test to use an inttoptr instead of
      directly loading from the undef pointer. Also, add an assert in
      IceTargetLoweringX8632::FormMemoryOperand() to make sure that undef
      pointers are never encountered.
      
      BUG=none
      R=jvoung@chromium.org, stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/432613002
  4. 30 Jul, 2014 6 commits
  5. 29 Jul, 2014 1 commit
  6. 28 Jul, 2014 2 commits
    • A couple of fixes for using Makefile.standalone on Mac. · 839c4cea
      Jan Voung authored
      (*) PNaCl toolchain_build builds 64-bit libraries for LLVM on Mac.
          That won't link with subzero code if subzero is built with -m32,
          so add an option to override the -m32.
      (*) include locale header
      (*) Mark xMacroIntegrityCheck unused to avoid clang compiler warning.
      (*) virtual dtor, for inheritable class
      (*) Mark compare function const
      
      BUG=none
      R=stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/428733003
    • Subzero: Make Ice::Ostream a typedef for llvm::raw_ostream. · 78282f6c
      Jim Stichnoth authored
      Previously Ostream was a class that wrapped a raw_ostream pointer,
      structured that way in case we wanted to wrap an alternate stream
      type.
      
      Also, Ostream used to include a Cfg pointer, but that had to go away
      when the Ostream became associated with the GlobalContext which
      persists beyond the Cfg lifetime, so the Cfg pointer was removed
      leaving only the raw_ostream.
      
      Since llvm::raw_ostream is supposed to be very lightweight, we can
      just give up the abstraction and equate it to Ice::Ostream.
      
      BUG= none
      R=kschimpf@google.com
      
      Review URL: https://codereview.chromium.org/413393005
  7. 25 Jul, 2014 1 commit
  8. 24 Jul, 2014 4 commits
  9. 23 Jul, 2014 3 commits
  10. 22 Jul, 2014 3 commits
  11. 21 Jul, 2014 1 commit
  12. 18 Jul, 2014 4 commits
  13. 17 Jul, 2014 1 commit
    • Lower the rest of the vector arithmetic operations. · 7fa22d8a
      Matt Wala authored
      The instructions emitted by the lowering operations require memory
      operands to be aligned to 16 bytes. Since there is no support for
      aligning memory operands in Subzero, do the arithmetic in registers for
      now.
      
      Add vector arithmetic to the arith crosstest. Pass the -mstackrealign
      parameter to the crosstest clang so that llc code called back from
      Subzero code (helper calls) doesn't assume that the stack is aligned at
      the entry to the call.
      
      BUG=none
      R=jvoung@chromium.org, stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/397833002
  14. 16 Jul, 2014 2 commits
    • Lower casting operations that involve vector types. · 83b8036b
      Matt Wala authored
      Impacted instructions:
      
      bitcast {v4f32, v4i32, v8i16, v16i8} <-> {v4f32, v4i32, v8i16, v16i8}
      bitcast v8i1 <-> i8
      bitcast v16i1 <-> i16
      
      (There was already code present to handle trivial bitcasts like v16i1 <-> v16i1.)
      
      [sz]ext v4i1 -> v4i32
      [sz]ext v8i1 -> v8i16
      [sz]ext v16i1 -> v16i8
      
      trunc v4i32 -> v4i1
      trunc v8i16 -> v8i1
      trunc v16i8 -> v16i1
      
      [su]itofp v4i32 -> v4f32
      fpto[su]i v4f32 -> v4i32
      
      Where there is a relatively simple lowering to x86 instructions, it has been used. Otherwise a helper call is used.
      
      Some lowerings require a materialization of a integer vector with 1s in each entry. Since there is no support for vector constant pools, the constant is materialized purely through register operations.
      
      BUG=none
      R=jvoung@chromium.org, stichnot@chromium.org
      
      Review URL: https://codereview.chromium.org/383303003
    • Lower bitmanip intrinsics, assuming absence of BMI/SSE4.2 for now. · e4da26f6
      Jan Voung authored
      We'll need the fallbacks in any case. However, once we've
      decided on how to specify the CPU features of the user
      machine we can use the nicer LZCNT/TZCNT/POPCNT as well.
      
      Adds cmov, bsf, and bsr instructions.
      
      Calls a popcount helper function for machines without SSE4.2.
      
      Not handling bswap yet (which can also take i16 params).
      
      BUG= https://code.google.com/p/nativeclient/issues/detail?id=3882
      R=stichnot@chromium.org, wala@chromium.org
      
      Review URL: https://codereview.chromium.org/390443005
  15. 15 Jul, 2014 2 commits
  16. 14 Jul, 2014 2 commits
  17. 11 Jul, 2014 4 commits