merge in jb-release history after reset to jb-dev
diff --git a/bcinfo/MetadataExtractor.cpp b/bcinfo/MetadataExtractor.cpp
index 6601ede..3be7e35 100644
--- a/bcinfo/MetadataExtractor.cpp
+++ b/bcinfo/MetadataExtractor.cpp
@@ -305,7 +305,7 @@
bool MetadataExtractor::populateForEachMetadata(
const llvm::NamedMDNode *Names,
const llvm::NamedMDNode *Signatures) {
- if (!Names || !Signatures) {
+ if (!Names && !Signatures) {
// Handle legacy case for pre-ICS bitcode that doesn't contain a metadata
// section for ForEach. We generate a full signature for a "root" function
// which means that we need to set the bottom 5 bits in the mask.
@@ -322,8 +322,14 @@
return true;
}
- mExportForEachSignatureCount = Signatures->getNumOperands();
- if (!mExportForEachSignatureCount) {
+ if (Signatures) {
+ mExportForEachSignatureCount = Signatures->getNumOperands();
+ if (!mExportForEachSignatureCount) {
+ return true;
+ }
+ } else {
+ mExportForEachSignatureCount = 0;
+ mExportForEachSignatureList = NULL;
return true;
}
@@ -347,11 +353,21 @@
}
}
- for (size_t i = 0; i < mExportForEachSignatureCount; i++) {
- llvm::MDNode *Name = Names->getOperand(i);
- if (Name != NULL && Name->getNumOperands() == 1) {
- TmpNameList[i] = createStringFromValue(Name->getOperand(0));
+ if (Names) {
+ for (size_t i = 0; i < mExportForEachSignatureCount; i++) {
+ llvm::MDNode *Name = Names->getOperand(i);
+ if (Name != NULL && Name->getNumOperands() == 1) {
+ TmpNameList[i] = createStringFromValue(Name->getOperand(0));
+ }
}
+ } else {
+ if (mExportForEachSignatureCount != 1) {
+ ALOGE("mExportForEachSignatureCount = %zu, but should be 1",
+ mExportForEachSignatureCount);
+ }
+ char *RootName = new char[5];
+ strncpy(RootName, "root", 5);
+ TmpNameList[0] = RootName;
}
mExportForEachNameList = TmpNameList;
diff --git a/lib/ScriptCRT/rs_cl.c b/lib/ScriptCRT/rs_cl.c
index 52960d6..8e6f8ef 100644
--- a/lib/ScriptCRT/rs_cl.c
+++ b/lib/ScriptCRT/rs_cl.c
@@ -501,8 +501,18 @@
extern float __attribute__((overloadable)) logb(float);
FN_FUNC_FN(logb)
-extern float __attribute__((overloadable)) mad(float, float, float);
-FN_FUNC_FN_FN_FN(mad)
+extern float __attribute__((overloadable)) mad(float a, float b, float c) {
+ return a * b + c;
+}
+extern float2 __attribute__((overloadable)) mad(float2 a, float2 b, float2 c) {
+ return a * b + c;
+}
+extern float3 __attribute__((overloadable)) mad(float3 a, float3 b, float3 c) {
+ return a * b + c;
+}
+extern float4 __attribute__((overloadable)) mad(float4 a, float4 b, float4 c) {
+ return a * b + c;
+}
extern float __attribute__((overloadable)) modf(float, float *);
FN_FUNC_FN_PFN(modf);