IVGCVSW-8314 Broadcast handling for Comparison layer is inconsistent.

* Added Comparison and LogicalBinary to AddBroadcastReshapeLayer
  optimization.

Signed-off-by: Colm Donelan <colm.donelan@arm.com>
Change-Id: I4f4bafb961daf63a733be9a1f17067fd246607ad
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp
index 654aeb5..3e04a19 100644
--- a/src/backends/reference/RefLayerSupport.cpp
+++ b/src/backends/reference/RefLayerSupport.cpp
@@ -14,8 +14,8 @@
 #include <LayerSupportCommon.hpp>
 #include <backendsCommon/LayerSupportRules.hpp>
 
-#include <vector>
 #include <array>
+#include <vector>
 
 namespace armnn
 {
@@ -940,6 +940,9 @@
     supported &= CheckSupportRule(TypeIs(output, DataType::Boolean), reasonIfUnsupported,
                                   "Reference comparison: output is not of type Boolean");
 
+    supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported,
+                                  "Reference comparison: shapes are not suitable for implicit broadcast.");
+
     return supported;
 }
 
@@ -1751,6 +1754,9 @@
     supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported,
                                   "Reference LogicalBinary: input and output types do not match");
 
+    supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input0, input1, output), reasonIfUnsupported,
+                                  "Reference LogicalBinary: shapes are not suitable for implicit broadcast.");
+
     return supported;
 }