[llvm] r292552 - [AArch64][GlobalISel] Split FP conversion legalizer tests. NFC.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 16:30:09 PST 2017


Author: ab
Date: Thu Jan 19 18:30:09 2017
New Revision: 292552

URL: http://llvm.org/viewvc/llvm-project?rev=292552&view=rev
Log:
[AArch64][GlobalISel] Split FP conversion legalizer tests. NFC.

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).

Added:
    llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir
    llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-itofp.mir
Modified:
    llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir

Added: llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir?rev=292552&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir (added)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-fptoi.mir Thu Jan 19 18:30:09 2017
@@ -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
+...

Added: llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-itofp.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-itofp.mir?rev=292552&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-itofp.mir (added)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-itofp.mir Thu Jan 19 18:30:09 2017
@@ -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
+...

Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir?rev=292552&r1=292551&r2=292552&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-simple.mir Thu Jan 19 18:30:09 2017
@@ -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
 
+    %1(s1) = G_TRUNC %0
+    %2(s8) = G_TRUNC %0
+    %3(s16) = G_TRUNC %0
+    %4(s32) = G_TRUNC %0
+
     ; 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
+    ; CHECK: %5(p0) = G_INTTOPTR %0
+    ; CHECK: %6(s64) = G_PTRTOINT %5
+    %5(p0) = G_INTTOPTR %0
+    %6(s64) = G_PTRTOINT %5
+
+    ; CHECK: G_BRCOND %1(s1), %bb.1.next
+    G_BRCOND %1, %bb.1.next
 
   bb.1.next:
-    %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: %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: %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
-
-    ; 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: %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: %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: %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
 ...




More information about the llvm-commits mailing list