summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Aart Bik <ajcbik@google.com> 2018-04-10 11:55:00 -0700
committer Aart Bik <ajcbik@google.com> 2018-04-13 10:01:41 -0700
commit3f8e02c3603cf48c7a656b2dd8781e11481fe34b (patch)
tree04c1722c0477342dcc6b6d45329c799d99120e81
parent8d2e70ae234d53f825f6876f5b5e75bdfe6729b5 (diff)
Bug fix in SIMD result detection.
Rationale: Only 2-way phis are currently used in reductions to carry SIMD results. Note that this will go away when we introduce proper SIMD types. Note: So far I have not been able to make a small regression test for this. Any pointers on how to set up a catch phi? Test: test-art-host,target Bug: b/77725987 Change-Id: I8f8b2dbec35e906878b7f7ed62690c3234db4211
-rw-r--r--compiler/optimizing/nodes_vector.h5
-rw-r--r--test/682-double-catch-phi/expected.txt1
-rw-r--r--test/682-double-catch-phi/info.txt1
-rw-r--r--test/682-double-catch-phi/smali/DoubleCatchPhi.smali47
-rw-r--r--test/682-double-catch-phi/src/Main.java26
5 files changed, 79 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes_vector.h b/compiler/optimizing/nodes_vector.h
index 9b114eb1f7..1a484e1944 100644
--- a/compiler/optimizing/nodes_vector.h
+++ b/compiler/optimizing/nodes_vector.h
@@ -171,9 +171,12 @@ class HVecOperation : public HVariableInputSizeInstruction {
if (instruction->IsVecOperation()) {
return !instruction->IsVecExtractScalar(); // only scalar returning vec op
} else if (instruction->IsPhi()) {
+ // Vectorizer only uses Phis in reductions, so checking for a 2-way phi
+ // with a direct vector operand as second argument suffices.
return
instruction->GetType() == kSIMDType &&
- instruction->InputAt(1)->IsVecOperation(); // vectorizer does not go deeper
+ instruction->InputCount() == 2 &&
+ instruction->InputAt(1)->IsVecOperation();
}
return false;
}
diff --git a/test/682-double-catch-phi/expected.txt b/test/682-double-catch-phi/expected.txt
new file mode 100644
index 0000000000..b0aad4deb5
--- /dev/null
+++ b/test/682-double-catch-phi/expected.txt
@@ -0,0 +1 @@
+passed
diff --git a/test/682-double-catch-phi/info.txt b/test/682-double-catch-phi/info.txt
new file mode 100644
index 0000000000..0ef2e59e9b
--- /dev/null
+++ b/test/682-double-catch-phi/info.txt
@@ -0,0 +1 @@
+Regression test on double-typed catch phi
diff --git a/test/682-double-catch-phi/smali/DoubleCatchPhi.smali b/test/682-double-catch-phi/smali/DoubleCatchPhi.smali
new file mode 100644
index 0000000000..1d3f927bb2
--- /dev/null
+++ b/test/682-double-catch-phi/smali/DoubleCatchPhi.smali
@@ -0,0 +1,47 @@
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+.class public LDoubleCatchPhi;
+
+.super Ljava/lang/Object;
+
+.field public mValue:D
+
+.method public constructor <init>()V
+.registers 1
+ invoke-direct {v0}, Ljava/lang/Object;-><init>()V
+ return-void
+.end method
+
+.method public strangeMethod(F)V
+.registers 6
+ move-object v2, v4
+ monitor-enter v4
+:try_start1
+ float-to-double v0, v5
+ iput-wide v0, v4, LDoubleCatchPhi;->mValue:D
+ monitor-exit v2
+:try_end1
+ goto :end_catch
+:catch
+:try_start2
+ move-exception v3
+ monitor-exit v2
+:try_end2
+ throw v3
+:end_catch
+ return-void
+.catchall {:try_start1 .. :try_end1} :catch
+.catchall {:try_start2 .. :try_end2} :catch
+.end method
diff --git a/test/682-double-catch-phi/src/Main.java b/test/682-double-catch-phi/src/Main.java
new file mode 100644
index 0000000000..e65bf0d4d4
--- /dev/null
+++ b/test/682-double-catch-phi/src/Main.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.Method;
+
+public class Main {
+ public static void main(String[] args) throws Exception {
+ if (System.getProperty("java.vm.name").equals("Dalvik")) {
+ Class<?> c = Class.forName("DoubleCatchPhi");
+ }
+ System.out.println("passed");
+ }
+}