]> granicus.if.org Git - llvm/commitdiff
[AArch64][InstructionSelector] Teach the selector how to handle vector OR.
authorQuentin Colombet <qcolombet@apple.com>
Tue, 11 Oct 2016 00:21:11 +0000 (00:21 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Tue, 11 Oct 2016 00:21:11 +0000 (00:21 +0000)
This only adds the support for 64-bit vector OR. Adding more sizes is
not difficult, but it requires a bigger refactoring because ORs work on
any size, not necessarly the ones that match the width of the register
width. Right now, this is not expressed in the legalization, so don't
bother pushing the refactoring yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283831 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64InstructionSelector.cpp
test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir

index b534f248e40531c13bbce3230f0e07a654ba6278..c8a00199e27bdbf17ac82737ca3201880ec1be5d 100644 (file)
@@ -175,6 +175,8 @@ static unsigned selectBinaryOp(unsigned GenericOpc, unsigned RegBankID,
         return AArch64::FMULDrr;
       case TargetOpcode::G_FDIV:
         return AArch64::FDIVDrr;
+      case TargetOpcode::G_OR:
+        return AArch64::ORRv8i8;
       default:
         return GenericOpc;
       }
index 8f280ecf88ad2b8cfe4f45b58211193efd29d72c..d4b81b920afcbf899722363c9d0c8d77701a7df4 100644 (file)
@@ -15,6 +15,7 @@
 
   define void @or_s32_gpr() { ret void }
   define void @or_s64_gpr() { ret void }
+  define void @or_v2s32_fpr() { ret void }
 
   define void @xor_s32_gpr() { ret void }
   define void @xor_s64_gpr() { ret void }
@@ -254,6 +255,37 @@ body:             |
     %2(s64) = G_OR %0, %1
 ...
 
+---
+# 64-bit G_OR on vector registers.
+# CHECK-LABEL: name: or_v2s32_fpr
+name:            or_v2s32_fpr
+legalized:       true
+regBankSelected: true
+#
+# CHECK:      registers:
+# CHECK-NEXT:  - { id: 0, class: fpr64 }
+# CHECK-NEXT:  - { id: 1, class: fpr64 }
+# CHECK-NEXT:  - { id: 2, class: fpr64 }
+registers:
+  - { id: 0, class: fpr }
+  - { id: 1, class: fpr }
+  - { id: 2, class: fpr }
+
+# CHECK:  body:
+# CHECK:    %0 = COPY %d0
+# CHECK:    %1 = COPY %d1
+# The actual OR does not matter as long as it is operating
+# on 64-bit width vector.
+# CHECK:    %2 = ORRv8i8 %0, %1
+body:             |
+  bb.0:
+    liveins: %d0, %d1
+
+      %0(<2 x s32>) = COPY %d0
+      %1(<2 x s32>) = COPY %d1
+      %2(<2 x s32>) = G_OR %0, %1
+...
+
 ---
 # Same as add_s32_gpr, for G_XOR operations.
 # CHECK-LABEL: name: xor_s32_gpr