[all-commits] [llvm/llvm-project] 6cf0da: orrectly generate invert xor value for Binary Atom...

jyu2-git via All-commits all-commits at lists.llvm.org
Tue Jul 7 10:21:31 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6cf0dac1ca3fd56c51f6a60f0be01cc25a1a2c6a
      https://github.com/llvm/llvm-project/commit/6cf0dac1ca3fd56c51f6a60f0be01cc25a1a2c6a
  Author: Jennifer Yu <jennifer.yu at intel.com>
  Date:   2020-07-07 (Tue, 07 Jul 2020)

  Changed paths:
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/test/CodeGen/Atomics.c

  Log Message:
  -----------
  orrectly generate invert xor value for Binary Atomics of int size > 64

When using __sync_nand_and_fetch with __int128, a problem is found that
the wrong value for the 'invert' value gets emitted to the xor in case
where the int size is greater than 64 bits.

This is because uses of llvm::ConstantInt::get which zero extends the
greater than 64 bits, so instead -1 that we require, it end up
getting 18446744073709551615

This patch replaces the call to llvm::ConstantInt::get with the call
to llvm::Constant::getAllOnesValue which works for all integer types.

Reviewers: jfp, erichkeane, rjmccall, hfinkel

Differential Revision: https://reviews.llvm.org/D82832




More information about the All-commits mailing list