r201901 - Reapply 201734 but with appropriate gcc compatibility

Chandler Carruth chandlerc at google.com
Fri Feb 21 15:41:17 PST 2014


On Fri, Feb 21, 2014 at 3:08 PM, Warren Hunt <whunt at google.com> wrote:

> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=201901&r1=201900&r2=201901&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri Feb 21 17:08:53 2014
> @@ -1500,6 +1500,42 @@ RValue CodeGenFunction::EmitBuiltinExpr(
>      return RValue::get(EmitLValue(E->getArg(0)).getAddress());
>    case Builtin::BI__noop:
>      return RValue::get(0);
> +  case Builtin::BI_InterlockedCompareExchange: {
> +    AtomicCmpXchgInst *CXI = Builder.CreateAtomicCmpXchg(
> +        EmitScalarExpr(E->getArg(0)),
> +        EmitScalarExpr(E->getArg(2)),
> +        EmitScalarExpr(E->getArg(1)),
> +        SequentiallyConsistent);
> +      CXI->setVolatile(true);
> +      return RValue::get(CXI);
> +  }
> +  case Builtin::BI_InterlockedIncrement: {
> +    AtomicRMWInst *RMWI = Builder.CreateAtomicRMW(
> +      AtomicRMWInst::Add,
> +      EmitScalarExpr(E->getArg(0)),
> +      ConstantInt::get(Int32Ty, 1),
> +      llvm::SequentiallyConsistent);
> +    RMWI->setVolatile(true);
> +    return RValue::get(Builder.CreateAdd(RMWI, ConstantInt::get(Int32Ty,
> 1)));
> +  }
> +  case Builtin::BI_InterlockedDecrement: {
> +    AtomicRMWInst *RMWI = Builder.CreateAtomicRMW(
> +      AtomicRMWInst::Sub,
> +      EmitScalarExpr(E->getArg(0)),
> +      ConstantInt::get(Int32Ty, 1),
> +      llvm::SequentiallyConsistent);
> +    RMWI->setVolatile(true);
> +    return RValue::get(Builder.CreateSub(RMWI, ConstantInt::get(Int32Ty,
> 1)));
> +  }
> +  case Builtin::BI_InterlockedExchangeAdd: {
> +    AtomicRMWInst *RMWI = Builder.CreateAtomicRMW(
> +      AtomicRMWInst::Add,
> +      EmitScalarExpr(E->getArg(0)),
> +      EmitScalarExpr(E->getArg(1)),
> +      llvm::SequentiallyConsistent);
> +    RMWI->setVolatile(true);
> +    return RValue::get(RMWI);
> +  }
>

Huh??? This doesn't seem to have anything to do with _mm_prefetch....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140221/923f7541/attachment.html>


More information about the cfe-commits mailing list