[llvm] c5abcb0 - [X86][GlobalISel] Reorganize tests for G_PHI and support fp80 (#100047)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 08:47:31 PDT 2024


Author: Evgenii Kudriashov
Date: 2024-07-24T17:47:27+02:00
New Revision: c5abcb0521dd81bfd8b736c5d03177cc3a2d0fe3

URL: https://github.com/llvm/llvm-project/commit/c5abcb0521dd81bfd8b736c5d03177cc3a2d0fe3
DIFF: https://github.com/llvm/llvm-project/commit/c5abcb0521dd81bfd8b736c5d03177cc3a2d0fe3.diff

LOG: [X86][GlobalISel] Reorganize tests for G_PHI and support fp80 (#100047)

* Verified scalar support of G_PHI
* Added cases with i1, ptr and x86_fp80 types
* Added phi inputs variability

We don't enable tests for i686 due to lack of float/integer types in
legalizer. We don't distinguish between illegal 64 bit integer G_LOAD
and legal double load using X87. It leads to artificial G_MERGE_VALUES
of floats into a single double.

Added: 
    llvm/test/CodeGen/X86/isel-phi.ll

Modified: 
    llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp

Removed: 
    llvm/test/CodeGen/X86/GlobalISel/phi.ll


################################################################################
diff  --git a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
index dd8ecf6ef7fc7..7169d588548b0 100644
--- a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
+++ b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
@@ -315,7 +315,8 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
   getActionDefinitionsBuilder(G_PHI)
       .legalIf([=](const LegalityQuery &Query) -> bool {
         return typeInSet(0, {s8, s16, s32, p0})(Query) ||
-               (Is64Bit && typeInSet(0, {s64})(Query)) ||
+               (UseX87 && typeIs(0, s80)(Query)) ||
+               (Is64Bit && typeIs(0, s64)(Query)) ||
                (HasSSE1 && typeInSet(0, {v16s8, v8s16, v4s32, v2s64})(Query)) ||
                (HasAVX && typeInSet(0, {v32s8, v16s16, v8s32, v4s64})(Query)) ||
                (HasAVX512 &&

diff  --git a/llvm/test/CodeGen/X86/GlobalISel/phi.ll b/llvm/test/CodeGen/X86/GlobalISel/phi.ll
deleted file mode 100644
index b29540f002598..0000000000000
--- a/llvm/test/CodeGen/X86/GlobalISel/phi.ll
+++ /dev/null
@@ -1,172 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL
-
-define i8 @test_i8(i32 %a, i8 %f, i8 %t) {
-; ALL-LABEL: test_i8:
-; ALL:       # %bb.0: # %entry
-; ALL-NEXT:    cmpl $0, %edi
-; ALL-NEXT:    setg %cl
-; ALL-NEXT:    testb $1, %cl
-; ALL-NEXT:    je .LBB0_2
-; ALL-NEXT:  # %bb.1:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    # kill: def $al killed $al killed $eax
-; ALL-NEXT:    retq
-; ALL-NEXT:  .LBB0_2: # %cond.false
-; ALL-NEXT:    movl %edx, %eax
-; ALL-NEXT:    # kill: def $al killed $al killed $eax
-; ALL-NEXT:    retq
-entry:
-  %cmp = icmp sgt i32 %a, 0
-  br i1 %cmp, label %cond.true, label %cond.false
-
-cond.true:                                        ; preds = %entry
-  br label %cond.end
-
-cond.false:                                       ; preds = %entry
-  br label %cond.end
-
-cond.end:                                         ; preds = %cond.false, %cond.true
-  %cond = phi i8 [ %f, %cond.true ], [ %t, %cond.false ]
-  ret i8 %cond
-}
-
-define i16 @test_i16(i32 %a, i16 %f, i16 %t) {
-; ALL-LABEL: test_i16:
-; ALL:       # %bb.0: # %entry
-; ALL-NEXT:    cmpl $0, %edi
-; ALL-NEXT:    setg %cl
-; ALL-NEXT:    testb $1, %cl
-; ALL-NEXT:    je .LBB1_2
-; ALL-NEXT:  # %bb.1:
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    # kill: def $ax killed $ax killed $eax
-; ALL-NEXT:    retq
-; ALL-NEXT:  .LBB1_2: # %cond.false
-; ALL-NEXT:    movl %edx, %eax
-; ALL-NEXT:    # kill: def $ax killed $ax killed $eax
-; ALL-NEXT:    retq
-entry:
-  %cmp = icmp sgt i32 %a, 0
-  br i1 %cmp, label %cond.true, label %cond.false
-
-cond.true:                                        ; preds = %entry
-  br label %cond.end
-
-cond.false:                                       ; preds = %entry
-  br label %cond.end
-
-cond.end:                                         ; preds = %cond.false, %cond.true
-  %cond = phi i16 [ %f, %cond.true ], [ %t, %cond.false ]
-  ret i16 %cond
-}
-
-define i32 @test_i32(i32 %a, i32 %f, i32 %t) {
-; ALL-LABEL: test_i32:
-; ALL:       # %bb.0: # %entry
-; ALL-NEXT:    movl %esi, %eax
-; ALL-NEXT:    cmpl $0, %edi
-; ALL-NEXT:    setg %cl
-; ALL-NEXT:    testb $1, %cl
-; ALL-NEXT:    je .LBB2_1
-; ALL-NEXT:  # %bb.2: # %cond.end
-; ALL-NEXT:    retq
-; ALL-NEXT:  .LBB2_1: # %cond.false
-; ALL-NEXT:    movl %edx, %eax
-; ALL-NEXT:    retq
-entry:
-  %cmp = icmp sgt i32 %a, 0
-  br i1 %cmp, label %cond.true, label %cond.false
-
-cond.true:                                        ; preds = %entry
-  br label %cond.end
-
-cond.false:                                       ; preds = %entry
-  br label %cond.end
-
-cond.end:                                         ; preds = %cond.false, %cond.true
-  %cond = phi i32 [ %f, %cond.true ], [ %t, %cond.false ]
-  ret i32 %cond
-}
-
-define i64 @test_i64(i32 %a, i64 %f, i64 %t) {
-; ALL-LABEL: test_i64:
-; ALL:       # %bb.0: # %entry
-; ALL-NEXT:    movq %rsi, %rax
-; ALL-NEXT:    cmpl $0, %edi
-; ALL-NEXT:    setg %cl
-; ALL-NEXT:    testb $1, %cl
-; ALL-NEXT:    je .LBB3_1
-; ALL-NEXT:  # %bb.2: # %cond.end
-; ALL-NEXT:    retq
-; ALL-NEXT:  .LBB3_1: # %cond.false
-; ALL-NEXT:    movq %rdx, %rax
-; ALL-NEXT:    retq
-entry:
-  %cmp = icmp sgt i32 %a, 0
-  br i1 %cmp, label %cond.true, label %cond.false
-
-cond.true:                                        ; preds = %entry
-  br label %cond.end
-
-cond.false:                                       ; preds = %entry
-  br label %cond.end
-
-cond.end:                                         ; preds = %cond.false, %cond.true
-  %cond = phi i64 [ %f, %cond.true ], [ %t, %cond.false ]
-  ret i64 %cond
-}
-
-define float @test_float(i32 %a, float %f, float %t) {
-; ALL-LABEL: test_float:
-; ALL:       # %bb.0: # %entry
-; ALL-NEXT:    cmpl $0, %edi
-; ALL-NEXT:    setg %al
-; ALL-NEXT:    testb $1, %al
-; ALL-NEXT:    je .LBB4_1
-; ALL-NEXT:  # %bb.2: # %cond.end
-; ALL-NEXT:    retq
-; ALL-NEXT:  .LBB4_1: # %cond.false
-; ALL-NEXT:    movaps %xmm1, %xmm0
-; ALL-NEXT:    retq
-entry:
-  %cmp = icmp sgt i32 %a, 0
-  br i1 %cmp, label %cond.true, label %cond.false
-
-cond.true:                                        ; preds = %entry
-  br label %cond.end
-
-cond.false:                                       ; preds = %entry
-  br label %cond.end
-
-cond.end:                                         ; preds = %cond.false, %cond.true
-  %cond = phi float [ %f, %cond.true ], [ %t, %cond.false ]
-  ret float %cond
-}
-
-define double @test_double(i32 %a, double %f, double %t) {
-; ALL-LABEL: test_double:
-; ALL:       # %bb.0: # %entry
-; ALL-NEXT:    cmpl $0, %edi
-; ALL-NEXT:    setg %al
-; ALL-NEXT:    testb $1, %al
-; ALL-NEXT:    je .LBB5_1
-; ALL-NEXT:  # %bb.2: # %cond.end
-; ALL-NEXT:    retq
-; ALL-NEXT:  .LBB5_1: # %cond.false
-; ALL-NEXT:    movaps %xmm1, %xmm0
-; ALL-NEXT:    retq
-entry:
-  %cmp = icmp sgt i32 %a, 0
-  br i1 %cmp, label %cond.true, label %cond.false
-
-cond.true:                                        ; preds = %entry
-  br label %cond.end
-
-cond.false:                                       ; preds = %entry
-  br label %cond.end
-
-cond.end:                                         ; preds = %cond.false, %cond.true
-  %cond = phi double [ %f, %cond.true ], [ %t, %cond.false ]
-  ret double %cond
-}

diff  --git a/llvm/test/CodeGen/X86/isel-phi.ll b/llvm/test/CodeGen/X86/isel-phi.ll
new file mode 100644
index 0000000000000..412aeac5eed6a
--- /dev/null
+++ b/llvm/test/CodeGen/X86/isel-phi.ll
@@ -0,0 +1,494 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=i686-linux-gnu -verify-machineinstrs < %s -o - | FileCheck %s --check-prefixes=X86
+; RUN: llc -mtriple=i686-linux-gnu -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s -o - | FileCheck %s --check-prefixes=X86
+; TODO: enable when x87 is supported
+; llc -mtriple=i686-linux-gnu -global-isel -global-isel-abort=1 -verify-machineinstrs < %s -o - | FileCheck %s --check-prefixes=X86,GLOBAL-X86
+; RUN: llc -mtriple=x86_64-linux-gnu -verify-machineinstrs < %s -o - | FileCheck %s --check-prefixes=X64,DAG-X64
+; RUN: llc -mtriple=x86_64-linux-gnu -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s -o - | FileCheck %s --check-prefixes=X64,DAG-X64
+; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 -verify-machineinstrs < %s -o - | FileCheck %s --check-prefixes=X64,GLOBAL-X64
+
+define i1 @test_i1(i1 %a, i1 %b, i1 %c, i1 %pred0, i1 %pred1) {
+; X86-LABEL: test_i1:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    je .LBB0_1
+; X86-NEXT:  # %bb.2: # %cond
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    je .LBB0_4
+; X86-NEXT:  # %bb.3:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB0_1:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB0_4: # %cond.false
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+;
+; X64-LABEL: test_i1:
+; X64:       # %bb.0: # %entry
+; X64-NEXT:    testb $1, %cl
+; X64-NEXT:    je .LBB0_1
+; X64-NEXT:  # %bb.2: # %cond
+; X64-NEXT:    movl %esi, %eax
+; X64-NEXT:    testb $1, %r8b
+; X64-NEXT:    jne .LBB0_4
+; X64-NEXT:  # %bb.3: # %cond.false
+; X64-NEXT:    movl %edx, %eax
+; X64-NEXT:  .LBB0_4: # %cond.end
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+; X64-NEXT:  .LBB0_1:
+; X64-NEXT:    movl %edi, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+entry:
+  br i1 %pred0, label %cond, label %cond.end
+
+cond:
+  br i1 %pred1, label %cond.true, label %cond.false
+
+cond.true:
+  br label %cond.end
+
+cond.false:
+  br label %cond.end
+
+cond.end:
+  %res = phi i1 [ %a, %entry ], [ %b, %cond.true ], [ %c, %cond.false ]
+  ret i1 %res
+}
+
+define i8 @test_i8(i8 %f, i8 %t, i1 %pred) {
+; X86-LABEL: test_i8:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    je .LBB1_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB1_2: # %cond.false
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+;
+; X64-LABEL: test_i8:
+; X64:       # %bb.0: # %entry
+; X64-NEXT:    testb $1, %dl
+; X64-NEXT:    je .LBB1_2
+; X64-NEXT:  # %bb.1:
+; X64-NEXT:    movl %edi, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+; X64-NEXT:  .LBB1_2: # %cond.false
+; X64-NEXT:    movl %esi, %eax
+; X64-NEXT:    # kill: def $al killed $al killed $eax
+; X64-NEXT:    retq
+entry:
+  br i1 %pred, label %cond.true, label %cond.false
+
+cond.true:                                        ; preds = %entry
+  br label %cond.end
+
+cond.false:                                       ; preds = %entry
+  br label %cond.end
+
+cond.end:                                         ; preds = %cond.false, %cond.true
+  %cond = phi i8 [ %f, %cond.true ], [ %t, %cond.false ]
+  ret i8 %cond
+}
+
+define i16 @test_i16(i16 %f, i16 %t, i1 %pred) {
+; X86-LABEL: test_i16:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    je .LBB2_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB2_2: # %cond.false
+; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+;
+; X64-LABEL: test_i16:
+; X64:       # %bb.0: # %entry
+; X64-NEXT:    testb $1, %dl
+; X64-NEXT:    je .LBB2_2
+; X64-NEXT:  # %bb.1:
+; X64-NEXT:    movl %edi, %eax
+; X64-NEXT:    # kill: def $ax killed $ax killed $eax
+; X64-NEXT:    retq
+; X64-NEXT:  .LBB2_2: # %cond.false
+; X64-NEXT:    movl %esi, %eax
+; X64-NEXT:    # kill: def $ax killed $ax killed $eax
+; X64-NEXT:    retq
+entry:
+  br i1 %pred, label %cond.true, label %cond.false
+
+cond.true:                                        ; preds = %entry
+  br label %cond.end
+
+cond.false:                                       ; preds = %entry
+  br label %cond.end
+
+cond.end:                                         ; preds = %cond.false, %cond.true
+  %cond = phi i16 [ %f, %cond.true ], [ %t, %cond.false ]
+  ret i16 %cond
+}
+
+define i32 @test_i32(i32 %f, i32 %t, i1 %pred) {
+; X86-LABEL: test_i32:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    je .LBB3_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB3_2: # %cond.false
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+;
+; X64-LABEL: test_i32:
+; X64:       # %bb.0: # %entry
+; X64-NEXT:    movl %edi, %eax
+; X64-NEXT:    testb $1, %dl
+; X64-NEXT:    jne .LBB3_2
+; X64-NEXT:  # %bb.1: # %cond.false
+; X64-NEXT:    movl %esi, %eax
+; X64-NEXT:  .LBB3_2: # %cond.end
+; X64-NEXT:    retq
+entry:
+  br i1 %pred, label %cond.true, label %cond.false
+
+cond.true:                                        ; preds = %entry
+  br label %cond.end
+
+cond.false:                                       ; preds = %entry
+  br label %cond.end
+
+cond.end:                                         ; preds = %cond.false, %cond.true
+  %cond = phi i32 [ %f, %cond.true ], [ %t, %cond.false ]
+  ret i32 %cond
+}
+
+define i64 @test_i64(i64 %f, i64 %t, i1 %pred) {
+; X86-LABEL: test_i64:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    je .LBB4_2
+; X86-NEXT:  # %bb.1:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB4_2: # %cond.false
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+;
+; X64-LABEL: test_i64:
+; X64:       # %bb.0: # %entry
+; X64-NEXT:    movq %rdi, %rax
+; X64-NEXT:    testb $1, %dl
+; X64-NEXT:    jne .LBB4_2
+; X64-NEXT:  # %bb.1: # %cond.false
+; X64-NEXT:    movq %rsi, %rax
+; X64-NEXT:  .LBB4_2: # %cond.end
+; X64-NEXT:    retq
+entry:
+  br i1 %pred, label %cond.true, label %cond.false
+
+cond.true:                                        ; preds = %entry
+  br label %cond.end
+
+cond.false:                                       ; preds = %entry
+  br label %cond.end
+
+cond.end:                                         ; preds = %cond.false, %cond.true
+  %cond = phi i64 [ %f, %cond.true ], [ %t, %cond.false ]
+  ret i64 %cond
+}
+
+define float @test_float(float %f, float %t, i1 %pred) {
+; X86-LABEL: test_float:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    flds {{[0-9]+}}(%esp)
+; X86-NEXT:    flds {{[0-9]+}}(%esp)
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    jne .LBB5_2
+; X86-NEXT:  # %bb.1: # %cond.false
+; X86-NEXT:    fstp %st(0)
+; X86-NEXT:    fldz
+; X86-NEXT:    fxch %st(1)
+; X86-NEXT:  .LBB5_2: # %cond.end
+; X86-NEXT:    fstp %st(1)
+; X86-NEXT:    retl
+;
+; X64-LABEL: test_float:
+; X64:       # %bb.0: # %entry
+; X64-NEXT:    testb $1, %dil
+; X64-NEXT:    jne .LBB5_2
+; X64-NEXT:  # %bb.1: # %cond.false
+; X64-NEXT:    movaps %xmm1, %xmm0
+; X64-NEXT:  .LBB5_2: # %cond.end
+; X64-NEXT:    retq
+entry:
+  br i1 %pred, label %cond.true, label %cond.false
+
+cond.true:                                        ; preds = %entry
+  br label %cond.end
+
+cond.false:                                       ; preds = %entry
+  br label %cond.end
+
+cond.end:                                         ; preds = %cond.false, %cond.true
+  %cond = phi float [ %f, %cond.true ], [ %t, %cond.false ]
+  ret float %cond
+}
+
+define double @test_double(i32 %a, double %f, double %t, i1 %pred) {
+; X86-LABEL: test_double:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    fldl {{[0-9]+}}(%esp)
+; X86-NEXT:    fldl {{[0-9]+}}(%esp)
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    jne .LBB6_2
+; X86-NEXT:  # %bb.1: # %cond.false
+; X86-NEXT:    fstp %st(0)
+; X86-NEXT:    fldz
+; X86-NEXT:    fxch %st(1)
+; X86-NEXT:  .LBB6_2: # %cond.end
+; X86-NEXT:    fstp %st(1)
+; X86-NEXT:    retl
+;
+; X64-LABEL: test_double:
+; X64:       # %bb.0: # %entry
+; X64-NEXT:    testb $1, %sil
+; X64-NEXT:    jne .LBB6_2
+; X64-NEXT:  # %bb.1: # %cond.false
+; X64-NEXT:    movaps %xmm1, %xmm0
+; X64-NEXT:  .LBB6_2: # %cond.end
+; X64-NEXT:    retq
+entry:
+  br i1 %pred, label %cond.true, label %cond.false
+
+cond.true:                                        ; preds = %entry
+  br label %cond.end
+
+cond.false:                                       ; preds = %entry
+  br label %cond.end
+
+cond.end:                                         ; preds = %cond.false, %cond.true
+  %cond = phi double [ %f, %cond.true ], [ %t, %cond.false ]
+  ret double %cond
+}
+
+define ptr @test_ptr(ptr %a, ptr %b, ptr %c, ptr %d, ptr %e, ptr %f, ptr %g, i1 %pred0, i1 %pred1, i1 %pred2) {
+; X86-LABEL: test_ptr:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    je .LBB7_6
+; X86-NEXT:  # %bb.1: # %cond.true
+; X86-NEXT:    testb $1, %cl
+; X86-NEXT:    je .LBB7_3
+; X86-NEXT:  # %bb.2:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB7_6: # %cond.false
+; X86-NEXT:    testb $1, %cl
+; X86-NEXT:    je .LBB7_10
+; X86-NEXT:  # %bb.7: # %cond.false.true
+; X86-NEXT:    testb $1, %al
+; X86-NEXT:    je .LBB7_9
+; X86-NEXT:  # %bb.8:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB7_3: # %cond.true.false
+; X86-NEXT:    testb $1, %al
+; X86-NEXT:    je .LBB7_5
+; X86-NEXT:  # %bb.4:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB7_10: # %cond.false.false
+; X86-NEXT:    testb $1, %al
+; X86-NEXT:    je .LBB7_12
+; X86-NEXT:  # %bb.11:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB7_9: # %cond.false.true.false
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB7_5: # %cond.true.false.false
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+; X86-NEXT:  .LBB7_12: # %cond.false.false.false
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    retl
+;
+; DAG-X64-LABEL: test_ptr:
+; DAG-X64:       # %bb.0: # %entry
+; DAG-X64-NEXT:    movq %rdi, %rax
+; DAG-X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %edi
+; DAG-X64-NEXT:    movzbl {{[0-9]+}}(%rsp), %r10d
+; DAG-X64-NEXT:    testb $1, {{[0-9]+}}(%rsp)
+; DAG-X64-NEXT:    je .LBB7_4
+; DAG-X64-NEXT:  # %bb.1: # %cond.true
+; DAG-X64-NEXT:    testb $1, %r10b
+; DAG-X64-NEXT:    jne .LBB7_9
+; DAG-X64-NEXT:  # %bb.2: # %cond.true.false
+; DAG-X64-NEXT:    testb $1, %dil
+; DAG-X64-NEXT:    movq %rsi, %rax
+; DAG-X64-NEXT:    jne .LBB7_9
+; DAG-X64-NEXT:  # %bb.3: # %cond.true.false.false
+; DAG-X64-NEXT:    movq %rdx, %rax
+; DAG-X64-NEXT:    retq
+; DAG-X64-NEXT:  .LBB7_4: # %cond.false
+; DAG-X64-NEXT:    testb $1, %r10b
+; DAG-X64-NEXT:    je .LBB7_7
+; DAG-X64-NEXT:  # %bb.5: # %cond.false.true
+; DAG-X64-NEXT:    testb $1, %dil
+; DAG-X64-NEXT:    movq %rcx, %rax
+; DAG-X64-NEXT:    jne .LBB7_9
+; DAG-X64-NEXT:  # %bb.6: # %cond.false.true.false
+; DAG-X64-NEXT:    movq %r8, %rax
+; DAG-X64-NEXT:    retq
+; DAG-X64-NEXT:  .LBB7_7: # %cond.false.false
+; DAG-X64-NEXT:    testb $1, %dil
+; DAG-X64-NEXT:    movq %r9, %rax
+; DAG-X64-NEXT:    jne .LBB7_9
+; DAG-X64-NEXT:  # %bb.8: # %cond.false.false.false
+; DAG-X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; DAG-X64-NEXT:  .LBB7_9: # %cond.end
+; DAG-X64-NEXT:    retq
+;
+; GLOBAL-X64-LABEL: test_ptr:
+; GLOBAL-X64:       # %bb.0: # %entry
+; GLOBAL-X64-NEXT:    movq %rdi, %rax
+; GLOBAL-X64-NEXT:    movl {{[0-9]+}}(%rsp), %r11d
+; GLOBAL-X64-NEXT:    movl {{[0-9]+}}(%rsp), %r10d
+; GLOBAL-X64-NEXT:    movl {{[0-9]+}}(%rsp), %edi
+; GLOBAL-X64-NEXT:    testb $1, %r11b
+; GLOBAL-X64-NEXT:    je .LBB7_4
+; GLOBAL-X64-NEXT:  # %bb.1: # %cond.true
+; GLOBAL-X64-NEXT:    testb $1, %r10b
+; GLOBAL-X64-NEXT:    jne .LBB7_9
+; GLOBAL-X64-NEXT:  # %bb.2: # %cond.true.false
+; GLOBAL-X64-NEXT:    testb $1, %dil
+; GLOBAL-X64-NEXT:    movq %rsi, %rax
+; GLOBAL-X64-NEXT:    jne .LBB7_9
+; GLOBAL-X64-NEXT:  # %bb.3: # %cond.true.false.false
+; GLOBAL-X64-NEXT:    movq %rdx, %rax
+; GLOBAL-X64-NEXT:    retq
+; GLOBAL-X64-NEXT:  .LBB7_4: # %cond.false
+; GLOBAL-X64-NEXT:    testb $1, %r10b
+; GLOBAL-X64-NEXT:    je .LBB7_7
+; GLOBAL-X64-NEXT:  # %bb.5: # %cond.false.true
+; GLOBAL-X64-NEXT:    testb $1, %dil
+; GLOBAL-X64-NEXT:    movq %rcx, %rax
+; GLOBAL-X64-NEXT:    jne .LBB7_9
+; GLOBAL-X64-NEXT:  # %bb.6: # %cond.false.true.false
+; GLOBAL-X64-NEXT:    movq %r8, %rax
+; GLOBAL-X64-NEXT:    retq
+; GLOBAL-X64-NEXT:  .LBB7_7: # %cond.false.false
+; GLOBAL-X64-NEXT:    testb $1, %dil
+; GLOBAL-X64-NEXT:    movq %r9, %rax
+; GLOBAL-X64-NEXT:    jne .LBB7_9
+; GLOBAL-X64-NEXT:  # %bb.8: # %cond.false.false.false
+; GLOBAL-X64-NEXT:    movq {{[0-9]+}}(%rsp), %rax
+; GLOBAL-X64-NEXT:  .LBB7_9: # %cond.end
+; GLOBAL-X64-NEXT:    retq
+entry:
+  br i1 %pred0, label %cond.true, label %cond.false
+
+cond.true:
+  br i1 %pred1, label %cond.end, label %cond.true.false
+
+cond.true.false:
+  br i1 %pred2, label %cond.true.false.true, label %cond.true.false.false
+
+cond.true.false.true:
+  br label %cond.end
+
+cond.true.false.false:
+  br label %cond.end
+
+cond.false:
+  br i1 %pred1, label %cond.false.true, label %cond.false.false
+
+cond.false.true:
+  br i1 %pred2, label %cond.false.true.true, label %cond.false.true.false
+
+cond.false.true.true:
+  br label %cond.end
+
+cond.false.true.false:
+  br label %cond.end
+
+cond.false.false:
+  br i1 %pred2, label %cond.false.false.true, label %cond.false.false.false
+
+cond.false.false.true:
+  br label %cond.end
+
+cond.false.false.false:
+  br label %cond.end
+
+cond.end:
+  %res = phi ptr [ %a, %cond.true ], [ %b, %cond.true.false.true ], [ %c, %cond.true.false.false ], [ %d, %cond.false.true.true ], [ %e, %cond.false.true.false ], [ %f, %cond.false.false.true ], [ %g, %cond.false.false.false ]
+  ret ptr %res
+}
+
+define x86_fp80 @test_fp80(x86_fp80 %f, x86_fp80 %t, i1 %pred) {
+; X86-LABEL: test_fp80:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    fldt {{[0-9]+}}(%esp)
+; X86-NEXT:    fldt {{[0-9]+}}(%esp)
+; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
+; X86-NEXT:    jne .LBB8_2
+; X86-NEXT:  # %bb.1: # %cond.false
+; X86-NEXT:    fstp %st(0)
+; X86-NEXT:    fldz
+; X86-NEXT:    fxch %st(1)
+; X86-NEXT:  .LBB8_2: # %cond.end
+; X86-NEXT:    fstp %st(1)
+; X86-NEXT:    retl
+;
+; DAG-X64-LABEL: test_fp80:
+; DAG-X64:       # %bb.0: # %entry
+; DAG-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
+; DAG-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
+; DAG-X64-NEXT:    testb $1, %dil
+; DAG-X64-NEXT:    jne .LBB8_2
+; DAG-X64-NEXT:  # %bb.1: # %cond.false
+; DAG-X64-NEXT:    fstp %st(0)
+; DAG-X64-NEXT:    fldz
+; DAG-X64-NEXT:    fxch %st(1)
+; DAG-X64-NEXT:  .LBB8_2: # %cond.end
+; DAG-X64-NEXT:    fstp %st(1)
+; DAG-X64-NEXT:    retq
+;
+; GLOBAL-X64-LABEL: test_fp80:
+; GLOBAL-X64:       # %bb.0: # %entry
+; GLOBAL-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
+; GLOBAL-X64-NEXT:    fldt {{[0-9]+}}(%rsp)
+; GLOBAL-X64-NEXT:    testb $1, %dil
+; GLOBAL-X64-NEXT:    jne .LBB8_2
+; GLOBAL-X64-NEXT:  # %bb.1: # %cond.false
+; GLOBAL-X64-NEXT:    fstp %st(1)
+; GLOBAL-X64-NEXT:    fldz
+; GLOBAL-X64-NEXT:  .LBB8_2: # %cond.end
+; GLOBAL-X64-NEXT:    fstp %st(0)
+; GLOBAL-X64-NEXT:    retq
+entry:
+  br i1 %pred, label %cond.true, label %cond.false
+
+cond.true:                                        ; preds = %entry
+  br label %cond.end
+
+cond.false:                                       ; preds = %entry
+  br label %cond.end
+
+cond.end:                                         ; preds = %cond.false, %cond.true
+  %cond = phi x86_fp80 [ %f, %cond.true ], [ %t, %cond.false ]
+  ret x86_fp80 %cond
+}


        


More information about the llvm-commits mailing list