From d48760da643cd8b4e61cf93623a6b32d3e8e4c0d Mon Sep 17 00:00:00 2001 From: Ranjeet Singh Date: Wed, 15 Jun 2016 14:21:28 +0000 Subject: [PATCH] Reverting r272777 because one of the tests added in the llvm patch is causing an assertion to fail. llvm-svn: 272790 --- clang/include/clang/Basic/BuiltinsARM.def | 10 ++-- clang/lib/CodeGen/CGBuiltin.cpp | 68 ----------------------- clang/test/CodeGen/builtins-arm.c | 30 +++------- clang/test/Sema/builtins-arm.c | 24 ++------ 4 files changed, 18 insertions(+), 114 deletions(-) diff --git a/clang/include/clang/Basic/BuiltinsARM.def b/clang/include/clang/Basic/BuiltinsARM.def index 1fa9794ca9de..4174c826dd4d 100644 --- a/clang/include/clang/Basic/BuiltinsARM.def +++ b/clang/include/clang/Basic/BuiltinsARM.def @@ -58,16 +58,14 @@ BUILTIN(__builtin_arm_stcl, "vUIiUIiv*", "") BUILTIN(__builtin_arm_stc2, "vUIiUIiv*", "") BUILTIN(__builtin_arm_stc2l, "vUIiUIiv*", "") -BUILTIN(__builtin_arm_cdp, "vUIiUIiUIiUIiUIiUIi", "") -BUILTIN(__builtin_arm_cdp2, "vUIiUIiUIiUIiUIiUIi", "") BUILTIN(__builtin_arm_mcr, "vUIiUIiUiUIiUIiUIi", "") BUILTIN(__builtin_arm_mcr2, "vUIiUIiUiUIiUIiUIi", "") BUILTIN(__builtin_arm_mrc, "UiUIiUIiUIiUIiUIi", "") BUILTIN(__builtin_arm_mrc2, "UiUIiUIiUIiUIiUIi", "") -BUILTIN(__builtin_arm_mcrr, "vUIiUIiLLUiUIi", "") -BUILTIN(__builtin_arm_mcrr2, "vUIiUIiLLUiUIi", "") -BUILTIN(__builtin_arm_mrrc, "LLUiUIiUIiUIi", "") -BUILTIN(__builtin_arm_mrrc2, "LLUiUIiUIiUIi", "") +BUILTIN(__builtin_arm_cdp, "vUIiUIiUIiUIiUIiUIi", "") +BUILTIN(__builtin_arm_cdp2, "vUIiUIiUIiUIiUIiUIi", "") +BUILTIN(__builtin_arm_mcrr, "vUIiUIiUiUiUIi", "") +BUILTIN(__builtin_arm_mcrr2, "vUIiUIiUiUiUIi", "") // CRC32 BUILTIN(__builtin_arm_crc32b, "UiUiUc", "nc") diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 462f1a7d6c56..0ec2b140ffa0 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -3793,74 +3793,6 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID, return EmitNounwindRuntimeCall(CGM.CreateRuntimeFunction(FTy, Name), Ops); } - if (BuiltinID == ARM::BI__builtin_arm_mcrr || - BuiltinID == ARM::BI__builtin_arm_mcrr2) { - Function *F; - - switch (BuiltinID) { - default: llvm_unreachable("unexpected builtin"); - case ARM::BI__builtin_arm_mcrr: - F = CGM.getIntrinsic(Intrinsic::arm_mcrr); - break; - case ARM::BI__builtin_arm_mcrr2: - F = CGM.getIntrinsic(Intrinsic::arm_mcrr2); - break; - } - - // MCRR{2} instruction has 5 operands but - // the intrinsic has 4 because Rt and Rt2 - // are represented as a single unsigned 64 - // bit integer in the intrinsic definition - // but internally it's represented as 2 32 - // bit integers. - - Value *Coproc = EmitScalarExpr(E->getArg(0)); - Value *Opc1 = EmitScalarExpr(E->getArg(1)); - Value *RtAndRt2 = EmitScalarExpr(E->getArg(2)); - Value *CRm = EmitScalarExpr(E->getArg(3)); - - Value *C1 = llvm::ConstantInt::get(Int64Ty, 32); - Value *Rt = Builder.CreateTruncOrBitCast(RtAndRt2, Int32Ty); - Value *Rt2 = Builder.CreateLShr(RtAndRt2, C1); - Rt2 = Builder.CreateTruncOrBitCast(Rt2, Int32Ty); - - return Builder.CreateCall(F, {Coproc, Opc1, Rt, Rt2, CRm}); - } - - if (BuiltinID == ARM::BI__builtin_arm_mrrc || - BuiltinID == ARM::BI__builtin_arm_mrrc2) { - Function *F; - - switch (BuiltinID) { - default: llvm_unreachable("unexpected builtin"); - case ARM::BI__builtin_arm_mrrc: - F = CGM.getIntrinsic(Intrinsic::arm_mrrc); - break; - case ARM::BI__builtin_arm_mrrc2: - F = CGM.getIntrinsic(Intrinsic::arm_mrrc2); - break; - } - - Value *Coproc = EmitScalarExpr(E->getArg(0)); - Value *Opc1 = EmitScalarExpr(E->getArg(1)); - Value *CRm = EmitScalarExpr(E->getArg(2)); - Value *RtAndRt2 = Builder.CreateCall(F, {Coproc, Opc1, CRm}); - - // Returns an unsigned 64 bit integer, represented - // as two 32 bit integers. - - Value *Rt = Builder.CreateExtractValue(RtAndRt2, 1); - Value *Rt1 = Builder.CreateExtractValue(RtAndRt2, 0); - Rt = Builder.CreateZExt(Rt, Int64Ty); - Rt1 = Builder.CreateZExt(Rt1, Int64Ty); - - Value *ShiftCast = llvm::ConstantInt::get(Int64Ty, 32); - RtAndRt2 = Builder.CreateShl(Rt, ShiftCast, "shl", true); - RtAndRt2 = Builder.CreateOr(RtAndRt2, Rt1); - - return Builder.CreateBitCast(RtAndRt2, ConvertType(E->getType())); - } - if (BuiltinID == ARM::BI__builtin_arm_ldrexd || ((BuiltinID == ARM::BI__builtin_arm_ldrex || BuiltinID == ARM::BI__builtin_arm_ldaex) && diff --git a/clang/test/CodeGen/builtins-arm.c b/clang/test/CodeGen/builtins-arm.c index a385bd27546a..df53b9f4cf99 100644 --- a/clang/test/CodeGen/builtins-arm.c +++ b/clang/test/CodeGen/builtins-arm.c @@ -1,7 +1,5 @@ // RUN: %clang_cc1 -Wall -Werror -triple thumbv7-eabi -target-cpu cortex-a8 -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -#include - void *f0() { return __builtin_thread_pointer(); @@ -182,28 +180,16 @@ void mcr2(unsigned a) { __builtin_arm_mcr2(15, 0, a, 13, 0, 3); } -void mcrr(uint64_t a) { - // CHECK: define void @mcrr(i64 %{{.*}}) - // CHECK: call void @llvm.arm.mcrr(i32 15, i32 0, i32 %{{[0-9]+}}, i32 %{{[0-9]+}}, i32 0) - __builtin_arm_mcrr(15, 0, a, 0); +void mcrr(unsigned a, unsigned b) { + // CHECK: define void @mcrr(i32 [[A:%.*]], i32 [[B:%.*]]) + // CHECK: call void @llvm.arm.mcrr(i32 15, i32 0, i32 [[A]], i32 [[B]], i32 0) + __builtin_arm_mcrr(15, 0, a, b, 0); } -void mcrr2(uint64_t a) { - // CHECK: define void @mcrr2(i64 %{{.*}}) - // CHECK: call void @llvm.arm.mcrr2(i32 15, i32 0, i32 %{{[0-9]+}}, i32 %{{[0-9]+}}, i32 0) - __builtin_arm_mcrr2(15, 0, a, 0); -} - -uint64_t mrrc() { - // CHECK: define i64 @mrrc() - // CHECK: call { i32, i32 } @llvm.arm.mrrc(i32 15, i32 0, i32 0) - return __builtin_arm_mrrc(15, 0, 0); -} - -uint64_t mrrc2() { - // CHECK: define i64 @mrrc2() - // CHECK: call { i32, i32 } @llvm.arm.mrrc2(i32 15, i32 0, i32 0) - return __builtin_arm_mrrc2(15, 0, 0); +void mcrr2(unsigned a, unsigned b) { + // CHECK: define void @mcrr2(i32 [[A:%.*]], i32 [[B:%.*]]) + // CHECK: call void @llvm.arm.mcrr2(i32 15, i32 0, i32 [[A]], i32 [[B]], i32 0) + __builtin_arm_mcrr2(15, 0, a, b, 0); } unsigned rsr() { diff --git a/clang/test/Sema/builtins-arm.c b/clang/test/Sema/builtins-arm.c index 668b8284ffeb..8a6d71773f42 100644 --- a/clang/test/Sema/builtins-arm.c +++ b/clang/test/Sema/builtins-arm.c @@ -116,23 +116,11 @@ void test6(int a, int b, int c) { __builtin_arm_mcr2(15, 0, b, 13, a, 3); // expected-error {{argument to '__builtin_arm_mcr2' must be a constant integer}} __builtin_arm_mcr2(15, 0, b, 13, 0, a); // expected-error {{argument to '__builtin_arm_mcr2' must be a constant integer}} - __builtin_arm_mcrr(15, 0, b, 0); - __builtin_arm_mcrr( a, 0, b, 0); // expected-error {{argument to '__builtin_arm_mcrr' must be a constant integer}} - __builtin_arm_mcrr(15, a, b, 0); // expected-error {{argument to '__builtin_arm_mcrr' must be a constant integer}} - __builtin_arm_mcrr(15, 0, b, a); // expected-error {{argument to '__builtin_arm_mcrr' must be a constant integer}} + __builtin_arm_mcrr( a, 0, b, c, 0); // expected-error {{argument to '__builtin_arm_mcrr' must be a constant integer}} + __builtin_arm_mcrr(15, a, b, c, 0); // expected-error {{argument to '__builtin_arm_mcrr' must be a constant integer}} + __builtin_arm_mcrr(15, 0, b, c, a); // expected-error {{argument to '__builtin_arm_mcrr' must be a constant integer}} - __builtin_arm_mcrr2(15, 0, b, 0); - __builtin_arm_mcrr2( a, 0, b, 0); // expected-error {{argument to '__builtin_arm_mcrr2' must be a constant integer}} - __builtin_arm_mcrr2(15, a, b, 0); // expected-error {{argument to '__builtin_arm_mcrr2' must be a constant integer}} - __builtin_arm_mcrr2(15, 0, b, a); // expected-error {{argument to '__builtin_arm_mcrr2' must be a constant integer}} - - __builtin_arm_mrrc(15, 0, 0); - __builtin_arm_mrrc( a, 0, 0); // expected-error {{argument to '__builtin_arm_mrrc' must be a constant integer}} - __builtin_arm_mrrc(15, a, 0); // expected-error {{argument to '__builtin_arm_mrrc' must be a constant integer}} - __builtin_arm_mrrc(15, 0, a); // expected-error {{argument to '__builtin_arm_mrrc' must be a constant integer}} - - __builtin_arm_mrrc2(15, 0, 0); - __builtin_arm_mrrc2( a, 0, 0); // expected-error {{argument to '__builtin_arm_mrrc2' must be a constant integer}} - __builtin_arm_mrrc2(15, a, 0); // expected-error {{argument to '__builtin_arm_mrrc2' must be a constant integer}} - __builtin_arm_mrrc2(15, 0, a); // expected-error {{argument to '__builtin_arm_mrrc2' must be a constant integer}} + __builtin_arm_mcrr2( a, 0, b, c, 0); // expected-error {{argument to '__builtin_arm_mcrr2' must be a constant integer}} + __builtin_arm_mcrr2(15, a, b, c, 0); // expected-error {{argument to '__builtin_arm_mcrr2' must be a constant integer}} + __builtin_arm_mcrr2(15, 0, b, c, a); // expected-error {{argument to '__builtin_arm_mcrr2' must be a constant integer}} }