[AArch64][GlobalISel] Split FP conversion legalizer tests. NFC.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Fri, 20 Jan 2017 00:30:09 +0000 (00:30 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Fri, 20 Jan 2017 00:30:09 +0000 (00:30 +0000)
Big functions with large vreg # are quite unwieldy to update.

Change it to have one function per test (it does increase boilerplate,
but makes the core hopefully more readable and maintanable).

llvm-svn: 292552

llvm/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir [new file with mode: 0644]
llvm/test/CodeGen/AArch64/GlobalISel/legalize-itofp.mir [new file with mode: 0644]
llvm/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir

diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir
new file mode 100644 (file)
index 0000000..968256c
--- /dev/null
@@ -0,0 +1,195 @@
+# RUN: llc -O0 -run-pass=legalizer -global-isel %s -o - 2>&1 | FileCheck %s
+
+--- |
+  target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+  target triple = "aarch64--"
+
+  define void @test_fptosi_s32_s32() { ret void }
+  define void @test_fptoui_s32_s32() { ret void }
+  define void @test_fptosi_s32_s64() { ret void }
+  define void @test_fptoui_s32_s64() { ret void }
+
+  define void @test_fptosi_s64_s32() { ret void }
+  define void @test_fptoui_s64_s32() { ret void }
+  define void @test_fptosi_s64_s64() { ret void }
+  define void @test_fptoui_s64_s64() { ret void }
+
+  define void @test_fptosi_s1_s32() { ret void }
+  define void @test_fptoui_s1_s32() { ret void }
+
+  define void @test_fptosi_s8_s64() { ret void }
+  define void @test_fptoui_s8_s64() { ret void }
+
+  define void @test_fptosi_s16_s32() { ret void }
+  define void @test_fptoui_s16_s32() { ret void }
+...
+
+---
+name:            test_fptosi_s32_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_fptosi_s32_s32
+    ; CHECK: %1(s32) = G_FPTOSI %0
+    %1:_(s32) = G_FPTOSI %0
+...
+
+---
+name:            test_fptoui_s32_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_fptoui_s32_s32
+    ; CHECK: %1(s32) = G_FPTOUI %0
+    %1:_(s32) = G_FPTOUI %0
+...
+
+---
+name:            test_fptosi_s32_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_fptosi_s32_s64
+    ; CHECK: %1(s32) = G_FPTOSI %0
+    %1:_(s32) = G_FPTOSI %0
+...
+
+---
+name:            test_fptoui_s32_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_fptoui_s32_s64
+    ; CHECK: %1(s32) = G_FPTOUI %0
+    %1:_(s32) = G_FPTOUI %0
+...
+
+---
+name:            test_fptosi_s64_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_fptosi_s64_s32
+    ; CHECK: %1(s64) = G_FPTOSI %0
+    %1:_(s64) = G_FPTOSI %0
+...
+
+---
+name:            test_fptoui_s64_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_fptoui_s64_s32
+    ; CHECK: %1(s64) = G_FPTOUI %0
+    %1:_(s64) = G_FPTOUI %0
+...
+
+---
+name:            test_fptosi_s64_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_fptosi_s64_s64
+    ; CHECK: %1(s64) = G_FPTOSI %0
+    %1:_(s64) = G_FPTOSI %0
+...
+
+---
+name:            test_fptoui_s64_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_fptoui_s64_s64
+    ; CHECK: %1(s64) = G_FPTOUI %0
+    %1:_(s64) = G_FPTOUI %0
+...
+
+
+
+---
+name:            test_fptosi_s1_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_fptosi_s1_s32
+    ; CHECK: %1(s1) = G_FPTOSI %0
+    %1:_(s1) = G_FPTOSI %0
+...
+
+---
+name:            test_fptoui_s1_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_fptoui_s1_s32
+    ; CHECK: %1(s1) = G_FPTOUI %0
+    %1:_(s1) = G_FPTOUI %0
+...
+
+---
+name:            test_fptosi_s8_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_fptosi_s8_s64
+    ; CHECK: %1(s8) = G_FPTOSI %0
+    %1:_(s8) = G_FPTOSI %0
+...
+
+---
+name:            test_fptoui_s8_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_fptoui_s8_s64
+    ; CHECK: %1(s8) = G_FPTOUI %0
+    %1:_(s8) = G_FPTOUI %0
+...
+
+---
+name:            test_fptosi_s16_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_fptosi_s16_s32
+    ; CHECK: %1(s16) = G_FPTOSI %0
+    %1:_(s16) = G_FPTOSI %0
+...
+
+---
+name:            test_fptoui_s16_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_fptoui_s16_s32
+    ; CHECK: %1(s16) = G_FPTOUI %0
+    %1:_(s16) = G_FPTOUI %0
+...
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-itofp.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-itofp.mir
new file mode 100644 (file)
index 0000000..176a7af
--- /dev/null
@@ -0,0 +1,200 @@
+# RUN: llc -O0 -run-pass=legalizer -global-isel %s -o - 2>&1 | FileCheck %s
+
+--- |
+  target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+  target triple = "aarch64--"
+
+  define void @test_sitofp_s32_s32() { ret void }
+  define void @test_uitofp_s32_s32() { ret void }
+  define void @test_sitofp_s32_s64() { ret void }
+  define void @test_uitofp_s32_s64() { ret void }
+
+  define void @test_sitofp_s64_s32() { ret void }
+  define void @test_uitofp_s64_s32() { ret void }
+  define void @test_sitofp_s64_s64() { ret void }
+  define void @test_uitofp_s64_s64() { ret void }
+
+  define void @test_sitofp_s32_s1() { ret void }
+  define void @test_uitofp_s32_s1() { ret void }
+
+  define void @test_sitofp_s64_s8() { ret void }
+  define void @test_uitofp_s64_s8() { ret void }
+
+  define void @test_sitofp_s32_s16() { ret void }
+  define void @test_uitofp_s32_s16() { ret void }
+...
+
+---
+name:            test_sitofp_s32_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_sitofp_s32_s32
+    ; CHECK: %1(s32) = G_SITOFP %0
+    %1:_(s32) = G_SITOFP %0
+...
+
+---
+name:            test_uitofp_s32_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_uitofp_s32_s32
+    ; CHECK: %1(s32) = G_UITOFP %0
+    %1:_(s32) = G_UITOFP %0
+...
+
+---
+name:            test_sitofp_s32_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_sitofp_s32_s64
+    ; CHECK: %1(s32) = G_SITOFP %0
+    %1:_(s32) = G_SITOFP %0
+...
+
+---
+name:            test_uitofp_s32_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_uitofp_s32_s64
+    ; CHECK: %1(s32) = G_UITOFP %0
+    %1:_(s32) = G_UITOFP %0
+...
+
+---
+name:            test_sitofp_s64_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_sitofp_s64_s32
+    ; CHECK: %1(s64) = G_SITOFP %0
+    %1:_(s64) = G_SITOFP %0
+...
+
+---
+name:            test_uitofp_s64_s32
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+
+    ; CHECK-LABEL: name: test_uitofp_s64_s32
+    ; CHECK: %1(s64) = G_UITOFP %0
+    %1:_(s64) = G_UITOFP %0
+...
+
+---
+name:            test_sitofp_s64_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_sitofp_s64_s64
+    ; CHECK: %1(s64) = G_SITOFP %0
+    %1:_(s64) = G_SITOFP %0
+...
+
+---
+name:            test_uitofp_s64_s64
+body: |
+  bb.0:
+    liveins: %x0
+    %0:_(s64) = COPY %x0
+
+    ; CHECK-LABEL: name: test_uitofp_s64_s64
+    ; CHECK: %1(s64) = G_UITOFP %0
+    %1:_(s64) = G_UITOFP %0
+...
+
+
+---
+name:            test_sitofp_s32_s1
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+    %1:_(s1) = G_TRUNC %0
+
+    ; CHECK-LABEL: name: test_sitofp_s32_s1
+    ; CHECK: %2(s32) = G_SITOFP %1
+    %2:_(s32) = G_SITOFP %1
+...
+
+---
+name:            test_uitofp_s32_s1
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+    %1:_(s1) = G_TRUNC %0
+
+    ; CHECK-LABEL: name: test_uitofp_s32_s1
+    ; CHECK: %2(s32) = G_UITOFP %1
+    %2:_(s32) = G_UITOFP %1
+...
+
+---
+name:            test_sitofp_s64_s8
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+    %1:_(s8) = G_TRUNC %0
+
+    ; CHECK-LABEL: name: test_sitofp_s64_s8
+    ; CHECK: %2(s64) = G_SITOFP %1
+    %2:_(s64) = G_SITOFP %1
+...
+
+---
+name:            test_uitofp_s64_s8
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+    %1:_(s8) = G_TRUNC %0
+
+    ; CHECK-LABEL: name: test_uitofp_s64_s8
+    ; CHECK: %2(s64) = G_UITOFP %1
+    %2:_(s64) = G_UITOFP %1
+...
+
+---
+name:            test_sitofp_s32_s16
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+    %1:_(s16) = G_TRUNC %0
+
+    ; CHECK-LABEL: name: test_sitofp_s32_s16
+    ; CHECK: %2(s32) = G_SITOFP %1
+    %2:_(s32) = G_SITOFP %1
+...
+
+---
+name:            test_uitofp_s32_s16
+body: |
+  bb.0:
+    liveins: %w0
+    %0:_(s32) = COPY %w0
+    %1:_(s16) = G_TRUNC %0
+
+    ; CHECK-LABEL: name: test_uitofp_s32_s16
+    ; CHECK: %2(s32) = G_UITOFP %1
+    %2:_(s32) = G_UITOFP %1
+...
index 41a9c33..17685fa 100644 (file)
@@ -31,103 +31,46 @@ registers:
   - { id: 14, class: _ }
   - { id: 15, class: _ }
   - { id: 16, class: _ }
-  - { id: 17, class: _ }
-  - { id: 18, class: _ }
-  - { id: 19, class: _ }
-  - { id: 20, class: _ }
-  - { id: 21, class: _ }
-  - { id: 22, class: _ }
-  - { id: 23, class: _ }
-  - { id: 24, class: _ }
-  - { id: 25, class: _ }
-  - { id: 26, class: _ }
-  - { id: 27, class: _ }
-  - { id: 28, class: _ }
-  - { id: 29, class: _ }
-  - { id: 30, class: _ }
-  - { id: 31, class: _ }
-  - { id: 32, class: _ }
-  - { id: 33, class: _ }
-  - { id: 34, class: _ }
 body: |
   bb.0.entry:
     liveins: %x0, %x1, %x2, %x3
     %0(s64) = COPY %x0
 
-    ; CHECK-LABEL: name: test_simple
-    ; CHECK: %1(p0) = G_INTTOPTR %0
-    ; CHECK: %2(s64) = G_PTRTOINT %1
-    %1(p0) = G_INTTOPTR %0
-    %2(s64) = G_PTRTOINT %1
-
-    ; CHECK: G_BRCOND %3(s1), %bb.1.next
-    %3(s1) = G_TRUNC %0
-    G_BRCOND %3, %bb.1.next
-
-  bb.1.next:
+    %1(s1) = G_TRUNC %0
+    %2(s8) = G_TRUNC %0
+    %3(s16) = G_TRUNC %0
     %4(s32) = G_TRUNC %0
 
-    ; CHECK: %5(s1) = G_FPTOSI %4
-    ; CHECK: %6(s8) = G_FPTOUI %4
-    ; CHECK: %7(s16) = G_FPTOSI %4
-    ; CHECK: %8(s32) = G_FPTOUI %4
-    ; CHECK: %9(s64) = G_FPTOSI %4
-    %5(s1) = G_FPTOSI %4
-    %6(s8) = G_FPTOUI %4
-    %7(s16) = G_FPTOSI %4
-    %8(s32) = G_FPTOUI %4
-    %9(s64) = G_FPTOSI %4
-
-    ; CHECK: %10(s1) = G_FPTOUI %0
-    ; CHECK: %11(s8) = G_FPTOSI %0
-    ; CHECK: %12(s16) = G_FPTOUI %0
-    ; CHECK: %13(s32) = G_FPTOSI %0
-    ; CHECK: %14(s32) = G_FPTOUI %0
-    %10(s1) = G_FPTOUI %0
-    %11(s8) = G_FPTOSI %0
-    %12(s16) = G_FPTOUI %0
-    %13(s32) = G_FPTOSI %0
-    %14(s32) = G_FPTOUI %0
+    ; CHECK-LABEL: name: test_simple
+    ; CHECK: %5(p0) = G_INTTOPTR %0
+    ; CHECK: %6(s64) = G_PTRTOINT %5
+    %5(p0) = G_INTTOPTR %0
+    %6(s64) = G_PTRTOINT %5
 
-    ; CHECK: %15(s32) = G_UITOFP %5
-    ; CHECK: %16(s32) = G_SITOFP %11
-    ; CHECK: %17(s32) = G_UITOFP %7
-    ; CHECK: %18(s32) = G_SITOFP %4
-    ; CHECK: %19(s32) = G_UITOFP %0
-    %15(s32) = G_UITOFP %5
-    %16(s32) = G_SITOFP %11
-    %17(s32) = G_UITOFP %7
-    %18(s32) = G_SITOFP %4
-    %19(s32) = G_UITOFP %0
+    ; CHECK: G_BRCOND %1(s1), %bb.1.next
+    G_BRCOND %1, %bb.1.next
 
-    ; CHECK: %20(s64) = G_SITOFP %5
-    ; CHECK: %21(s64) = G_UITOFP %11
-    ; CHECK: %22(s64) = G_SITOFP %7
-    ; CHECK: %23(s64) = G_UITOFP %4
-    ; CHECK: %24(s64) = G_SITOFP %0
-    %20(s64) = G_SITOFP %5
-    %21(s64) = G_UITOFP %11
-    %22(s64) = G_SITOFP %7
-    %23(s64) = G_UITOFP %4
-    %24(s64) = G_SITOFP %0
+  bb.1.next:
 
-    ; CHECK: %25(s1) = G_SELECT %10(s1), %10, %5
-    ; CHECK: %26(s8) = G_SELECT %10(s1), %6, %11
-    ; CHECK: %27(s16) = G_SELECT %10(s1), %12, %7
-    ; CHECK: %28(s32) = G_SELECT %10(s1), %15, %16
-    ; CHECK: %29(s64) = G_SELECT %10(s1), %9, %24
-    %25(s1) = G_SELECT %10, %10, %5
-    %26(s8) = G_SELECT %10, %6, %11
-    %27(s16) = G_SELECT %10, %12, %7
-    %28(s32) = G_SELECT %10, %15, %16
-    %29(s64) = G_SELECT %10, %9, %24
+    ; CHECK: %7(s1) = G_SELECT %1(s1), %1, %1
+    ; CHECK: %8(s8) = G_SELECT %1(s1), %2, %2
+    ; CHECK: %9(s16) = G_SELECT %1(s1), %3, %3
+    ; CHECK: %10(s32) = G_SELECT %1(s1), %4, %4
+    ; CHECK: %11(s64) = G_SELECT %1(s1), %0, %0
+    %7(s1) = G_SELECT %1, %1, %1
+    %8(s8) = G_SELECT %1, %2, %2
+    %9(s16) = G_SELECT %1, %3, %3
+    %10(s32) = G_SELECT %1, %4, %4
+    %11(s64) = G_SELECT %1, %0, %0
 
-    ; CHECK: %30(<2 x s32>) = G_BITCAST %9
-    ; CHECK: %31(s64) = G_BITCAST %30
-    ; CHECK: %32(s32) = G_BITCAST %15
-    %30(<2 x s32>) = G_BITCAST %9
-    %31(s64) = G_BITCAST %30
-    %32(s32) = G_BITCAST %15
-    %33(<4 x s8>) = G_BITCAST %15
-    %34(<2 x s16>) = G_BITCAST %15
+    ; CHECK: %12(<2 x s32>) = G_BITCAST %0
+    ; CHECK: %13(s64) = G_BITCAST %12
+    ; CHECK: %14(s32) = G_BITCAST %10
+    ; CHECK: %15(<4 x s8>) = G_BITCAST %0
+    ; CHECK: %16(<2 x s16>) = G_BITCAST %0
+    %12(<2 x s32>) = G_BITCAST %0
+    %13(s64) = G_BITCAST %12
+    %14(s32) = G_BITCAST %10
+    %15(<4 x s8>) = G_BITCAST %0
+    %16(<2 x s16>) = G_BITCAST %0
 ...