1. Sep 10, 2016
  2. Sep 09, 2016
    • Sam Kolton's avatar
      AMDGPU] Assembler: better support for immediate literals in assembler. · 1eeb11bf
      Sam Kolton authored
      Summary:
      Prevously assembler parsed all literals as either 32-bit integers or 32-bit floating-point values. Because of this we couldn't support f64 literals.
      E.g. in instruction "v_fract_f64 v[0:1], 0.5", literal 0.5 was encoded as 32-bit literal 0x3f000000, which is incorrect and will be interpreted as 3.0517578125E-5 instead of 0.5. Correct encoding is inline constant 240 (optimal) or 32-bit literal 0x3FE00000 at least.
      
      With this change the way immediate literals are parsed is changed. All literals are always parsed as 64-bit values either integer or floating-point. Then we convert parsed literals to correct form based on information about type of operand parsed (was literal floating or binary) and type of expected instruction operands (is this f32/64 or b32/64 instruction).
      Here are rules how we convert literals:
          - We parsed fp literal:
              - Instruction expects 64-bit operand:
                  - If parsed literal is inlinable (e.g. v_fract_f64_e32 v[0:1], 0.5)
                      - then we do nothing this literal
                  - Else if literal is not-inlinable but instruction requires to inline it (e.g. this is e64 encoding, v_fract_f64_e64 v[0:1], 1.5)
                      - report error
                  - Else literal is not-inlinable but we can encode it as additional 32-bit literal constant
                      - If instruction expect fp operand type (f64)
                          - Check if low 32 bits of literal are zeroes (e.g. v_fract_f64 v[0:1], 1.5)
                              - If so then do nothing
                          - Else (e.g. v_fract_f64 v[0:1], 3.1415)
                              - report warning that low 32 bits will be set to zeroes and precision will be lost
                              - set low 32 bits of literal to zeroes
                      - Instruction expects integer operand type (e.g. s_mov_b64_e32 s[0:1], 1.5)
                          - report error as it is unclear how to encode this literal
              - Instruction expects 32-bit operand:
                  - Convert parsed 64 bit fp literal to 32 bit fp. Allow lose of precision but not overflow or underflow
                  - Is this literal inlinable and are we required to inline literal (e.g. v_trunc_f32_e64 v0, 0.5)
                      - do nothing
                      - Else report error
                  - Do nothing. We can encode any other 32-bit fp literal (e.g. v_trunc_f32 v0, 10000000.0)
          - Parsed binary literal:
              - Is this literal inlinable (e.g. v_trunc_f32_e32 v0, 35)
                  - do nothing
              - Else, are we required to inline this literal (e.g. v_trunc_f32_e64 v0, 35)
                  - report error
              - Else, literal is not-inlinable and we are not required to inline it
                  - Are high 32 bit of literal zeroes or same as sign bit (32 bit)
                      - do nothing (e.g. v_trunc_f32 v0, 0xdeadbeef)
                  - Else
                      - report error (e.g. v_trunc_f32 v0, 0x123456789abcdef0)
      
      For this change it is required that we know operand types of instruction (are they f32/64 or b32/64). I added several new register operands (they extend previous register operands) and set operand types to corresponding types:
      '''
      enum OperandType {
          OPERAND_REG_IMM32_INT,
          OPERAND_REG_IMM32_FP,
          OPERAND_REG_INLINE_C_INT,
          OPERAND_REG_INLINE_C_FP,
      }
      '''
      
      This is not working yet:
          - Several tests are failing
          - Problems with predicate methods for inline immediates
          - LLVM generated assembler parts try to select e64 encoding before e32.
      More changes are required for several AsmOperands.
      
      Reviewers: vpykhtin, tstellarAMD
      
      Subscribers: arsenm, kzhuravl, artem.tamazov
      
      Differential Revision: https://reviews.llvm.org/D22922
      
      llvm-svn: 281050
      1eeb11bf
    • George Rimar's avatar
      Recommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards. · cd574a5e
      George Rimar authored
      Fixed code that was not checked before on windows for me, because of testcases that are
      disabled on that platform atm.
      
      Inital commit message:
      "[ELF] - Versionscript: do not treat non-wildcarded names as wildcards."
      Previously we incorrectly handled cases when symbol name in extern c++ tag
      was enclosed in quotes. Next case was treated as wildcard:
      
      GLIBCXX_3.4 {                                                                   
          extern "C++" {  
          "aaa*"
         }
      But it should have not. Quotes around aaa here means that we should have do exact
      name matching.
      That is PR30268 which has name with pointer is interpreted as wildcard by lld:
      
      extern "C++" {                                                              
          "operator delete[](void*)";
      
      Patch fixes the issue.
      
      Differential revision: https://reviews.llvm.org/D24229
      
      llvm-svn: 281049
      cd574a5e
    • Filipe Cabecinhas's avatar
      [asan] Since r280945 fixed the OS X abort() problem, merge... · e3c7f54e
      Filipe Cabecinhas authored
      [asan] Since r280945 fixed the OS X abort() problem, merge scariness_score_test.cc and make it a general test.
      
      Summary: Merges back both scariness_score_test.cc files, since the Linux-specific version shouldn't be needed any more.
      
      Reviewers: kcc, eugenis, vitalybuka
      
      Subscribers: llvm-commits, kubabrecka
      
      Differential Revision: https://reviews.llvm.org/D24347
      
      llvm-svn: 281048
      e3c7f54e
    • Chris Dewhurst's avatar
      [Sparc][LEON] Removed the parts of the errata fixes implemented using inline... · c59f7c74
      Chris Dewhurst authored
      [Sparc][LEON] Removed the parts of the errata fixes implemented using inline assembly as this is not the desired behaviour for end-users. Small change to a unit test to implement this without requiring the inline assembly.
      
      llvm-svn: 281047
      c59f7c74
    • George Rimar's avatar
      6368525e
    • George Rimar's avatar
      Recommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards. · b5e77c47
      George Rimar authored
      Fixed code that was not checked by testcases that are disabled on windows.
      
      Inital commit message:
      "[ELF] - Versionscript: do not treat non-wildcarded names as wildcards."
      Previously we incorrectly handled cases when symbol name in extern c++ tag
      was enclosed in quotes. Next case was treated as wildcard:
      
      GLIBCXX_3.4 {                                                                   
          extern "C++" {  
          "aaa*"
         }
      But it should have not. Quotes around aaa here means that we should have do exact
      name matching.
      That is PR30268 which has name with pointer is interpreted as wildcard by lld:
      
      extern "C++" {                                                              
          "operator delete[](void*)";
      
      Patch fixes the issue.
      
      Differential revision: https://reviews.llvm.org/D24229
      
      llvm-svn: 281045
      b5e77c47
    • James Molloy's avatar
      [ARM] ADD with a negative offset can become SUB for free · 57d9dfa9
      James Molloy authored
      So model that directly in TTI::getIntImmCost().
      
      llvm-svn: 281044
      57d9dfa9
    • James Molloy's avatar
      [ARM] icmp %x, -C can be lowered to a simple ADDS or CMN · 1454e90f
      James Molloy authored
      Tell TargetTransformInfo about this so ConstantHoisting is informed.
      
      llvm-svn: 281043
      1454e90f
    • Simon Pilgrim's avatar
      [SelectionDAG] Ensure DAG::getZeroExtendInReg is called with a scalar type · 153b4084
      Simon Pilgrim authored
      Fixes issue with rL280927 identified by Mikael Holmén
      
      llvm-svn: 281042
      153b4084
    • George Rimar's avatar
    • James Molloy's avatar
      [Thumb] Select (CMPZ X, -C) -> (CMPZ (ADDS X, C), 0) · 4d86bed0
      James Molloy authored
      The CMPZ #0 disappears during peepholing, leaving just a tADDi3, tADDi8 or t2ADDri. This avoids having to materialize the expensive negative constant in Thumb-1, and allows a shrinking from a 32-bit CMN to a 16-bit ADDS in Thumb-2.
      
      llvm-svn: 281040
      4d86bed0
    • Tobias Grosser's avatar
      Add namespace specifier before nullptr_t · a6987a4d
      Tobias Grosser authored
      This fixes the following compile time errors:
      
        error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'
      
      llvm-svn: 281039
      a6987a4d
    • George Rimar's avatar
      [ELF] - Versionscript: do not treat non-wildcarded names as wildcards. · d2203843
      George Rimar authored
      Previously we incorrectly handled cases when symbol name in extern c++ tag
      was enclosed in quotes. Next case was treated as wildcard:
      
      GLIBCXX_3.4 {                                                                   
          extern "C++" {  
          "aaa*"
         }
      But it should have not. Quotes around aaa here means that we should have do exact
      name matching.
      That is PR30268 which has name with pointer is interpreted as wildcard by lld:
      
      extern "C++" {                                                              
          "operator delete[](void*)";
      
      Patch fixes the issue.
      
      Differential revision: https://reviews.llvm.org/D24229
      
      llvm-svn: 281038
      d2203843
    • Tim Northover's avatar
      GlobalISel: remove G_TYPE and G_PHI · 25d1286e
      Tim Northover authored
      These instructions were only necessary when type information was stored in the
      MachineInstr (because only generic MachineInstrs possessed a type). Now that
      it's in MachineRegisterInfo, COPY and PHI work fine.
      
      llvm-svn: 281037
      25d1286e
    • Tim Northover's avatar
      GlobalISel: fix comments and add assertions for valid instructions. · 1f8b1db9
      Tim Northover authored
      llvm-svn: 281036
      1f8b1db9
    • Tim Northover's avatar
      GlobalISel: move type information to MachineRegisterInfo. · 0f140c76
      Tim Northover authored
      We want each register to have a canonical type, which means the best place to
      store this is in MachineRegisterInfo rather than on every MachineInstr that
      happens to use or define that register.
      
      Most changes following from this are pretty simple (you need an MRI anyway if
      you're going to be doing any transformations, so just check the type there).
      But legalization doesn't really want to check redundant operands (when, for
      example, a G_ADD only ever has one type) so I've made use of MCInstrDesc's
      operand type field to encode these constraints and limit legalization's work.
      
      As an added bonus, more validation is possible, both in MachineVerifier and
      MachineIRBuilder (coming soon).
      
      llvm-svn: 281035
      0f140c76
    • Tobias Grosser's avatar
      IslNodeBuilder: Add missing __isl_take annotation · a3afe44d
      Tobias Grosser authored
      llvm-svn: 281034
      a3afe44d
    • Simon Dardis's avatar
      Revert "[mips] Fix c.<cc>.<fmt> instruction definition." · ba92b034
      Simon Dardis authored
      This reverts commit r281022. Mips buildbot broke, due to unhandled register
      class FCC.
      
      llvm-svn: 281033
      ba92b034
    • Nitesh Jain's avatar
      [LLDB][MIPS] Fix Emulation for JALR64 Instruction · 817bc16d
      Nitesh Jain authored
      Subscribers: jaydeep, bhushan, slthakur, sdardis, lldb-commits
      llvm-svn: 281032
      817bc16d