This patch addresses PR13949.

For the PowerPC 64-bit ELF Linux ABI, aggregates of size less than 8
bytes are to be passed in the low-order bits ("right-adjusted") of the
doubleword register or memory slot assigned to them.  A previous patch
addressed this for aggregates passed in registers.  However, small
aggregates passed in the overflow portion of the parameter save area are
still being passed left-adjusted.

The fix is made in PPCTargetLowering::LowerCall_Darwin_Or_64SVR4 on the
caller side, and in PPCTargetLowering::LowerFormalArguments_64SVR4 on
the callee side.  The main fix on the callee side simply extends
existing logic for 1- and 2-byte objects to 1- through 7-byte objects,
and correcting a constant left over from 32-bit code.  There is also a
fix to a bogus calculation of the offset to the following argument in
the parameter save area.

On the caller side, again a constant left over from 32-bit code is
fixed.  Additionally, some code for 1, 2, and 4-byte objects is
duplicated to handle the 3, 5, 6, and 7-byte objects for SVR4 only.  The
LowerCall_Darwin_Or_64SVR4 logic is getting fairly convoluted trying to
handle both ABIs, and I propose to separate this into two functions in a
future patch, at which time the duplication can be removed.

The patch adds a new test (structsinmem.ll) to demonstrate correct
passing of structures of all seven sizes.  Eight dummy parameters are
used to force these structures to be in the overflow portion of the
parameter save area.

As a side effect, this corrects the case when aggregates passed in
registers are saved into the first eight doublewords of the parameter
save area:  Previously they were stored left-justified, and now are
properly stored right-justified.  This requires changing the expected
output of existing test case structsinregs.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166022 91177308-0d34-0410-b5e6-96231b3b80d8
Fix function parameter spelling in comments.  Caught by -Wdocumentation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166024 91177308-0d34-0410-b5e6-96231b3b80d8
Speculative fix the mask constants to be of type uintptr_t.  I don't know of any case where the old form was incorrect, but I'm more confident that such cases don't exist in this version.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166031 91177308-0d34-0410-b5e6-96231b3b80d8
Use the appropriate Attributes::get method to create an Attributes object.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166035 91177308-0d34-0410-b5e6-96231b3b80d8
Support v8f32 to v8i8/vi816 conversion through custom lowering

- Add custom FP_TO_SINT on v8i16 (and v8i8 which is legalized as v8i16 due to
  vector element-wise widening) to reduce DAG combiner and its overhead added
  in X86 backend.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166036 91177308-0d34-0410-b5e6-96231b3b80d8
And now we can call the other 'get' method from this one and not duplicate the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166037 91177308-0d34-0410-b5e6-96231b3b80d8
Simplify potentially quadratic behavior while erasing elements from std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166045 91177308-0d34-0410-b5e6-96231b3b80d8
Switch back to the old coalescer for now to fix the 32 bit bit
llvm+clang+compiler-rt bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166046 91177308-0d34-0410-b5e6-96231b3b80d8
Teach DAG combine to fold (trunc (fptoXi x)) to (fptoXi x)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166049 91177308-0d34-0410-b5e6-96231b3b80d8
80-col fixup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166050 91177308-0d34-0410-b5e6-96231b3b80d8
Check .rela instead of ELF64 for the compensation vaue resetting



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166051 91177308-0d34-0410-b5e6-96231b3b80d8
Simplify code. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166053 91177308-0d34-0410-b5e6-96231b3b80d8
[ms-inline asm] Add the helper function, isParseringInlineAsm(). To be used in a future commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166054 91177308-0d34-0410-b5e6-96231b3b80d8
[InstCombine] Teach InstCombine how to handle an obfuscated splat.

An obfuscated splat is where the frontend poorly generates code for a splat
using several different shuffles to create the splat, i.e.,

  %A = load <4 x float>* %in_ptr, align 16
  %B = shufflevector <4 x float> %A, <4 x float> undef, <4 x i32> <i32 0, i32 0, i32 undef, i32 undef>
  %C = shufflevector <4 x float> %B, <4 x float> %A, <4 x i32> <i32 0, i32 1, i32 4, i32 undef>
  %D = shufflevector <4 x float> %C, <4 x float> %A, <4 x i32> <i32 0, i32 1, i32 2, i32 4>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166061 91177308-0d34-0410-b5e6-96231b3b80d8
Revert r166046 "Switch back to the old coalescer for now to fix the 32 bit bit"

A fix for PR14098, including the test case is in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166067 91177308-0d34-0410-b5e6-96231b3b80d8
Avoid rematerializing a redef immediately after the old def.

PR14098 contains an example where we would rematerialize a MOV8ri
immediately after the original instruction:

  %vreg7:sub_8bit<def> = MOV8ri 9; GR32_ABCD:%vreg7
  %vreg22:sub_8bit<def> = MOV8ri 9; GR32_ABCD:%vreg7

Besides being pointless, it is also wrong since the original instruction
only redefines part of the register, and the value read by the new
instruction is wrong.

The problem was the LiveRangeEdit::allUsesAvailableAt() didn't
special-case OrigIdx == UseIdx and found the wrong SSA value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166068 91177308-0d34-0410-b5e6-96231b3b80d8
Spacing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166074 91177308-0d34-0410-b5e6-96231b3b80d8
Formatting and 80-col.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166075 91177308-0d34-0410-b5e6-96231b3b80d8
Variable name cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166076 91177308-0d34-0410-b5e6-96231b3b80d8
Use a typedef to reduce some typing and reformat code accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166077 91177308-0d34-0410-b5e6-96231b3b80d8