Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / test / CodeGen / Mips / GlobalISel / llvm-ir / select.ll
blobf15977cf6b78bdfea3565e354b7af0f353029db0
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc  -O0 -mtriple=mipsel-linux-gnu -global-isel  -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32
4 define i8 @select_i8(i1 %test, i8 %a, i8 %b) {
5 ; MIPS32-LABEL: select_i8:
6 ; MIPS32:       # %bb.0: # %entry
7 ; MIPS32-NEXT:    lui $1, 0
8 ; MIPS32-NEXT:    ori $1, $1, 1
9 ; MIPS32-NEXT:    and $1, $4, $1
10 ; MIPS32-NEXT:    movn $6, $5, $1
11 ; MIPS32-NEXT:    move $2, $6
12 ; MIPS32-NEXT:    jr $ra
13 ; MIPS32-NEXT:    nop
14 entry:
15   %cond = select i1 %test, i8 %a, i8 %b
16   ret i8 %cond
19 define i16 @select_i16(i1 %test, i16 %a, i16 %b) {
20 ; MIPS32-LABEL: select_i16:
21 ; MIPS32:       # %bb.0: # %entry
22 ; MIPS32-NEXT:    lui $1, 0
23 ; MIPS32-NEXT:    ori $1, $1, 1
24 ; MIPS32-NEXT:    and $1, $4, $1
25 ; MIPS32-NEXT:    movn $6, $5, $1
26 ; MIPS32-NEXT:    move $2, $6
27 ; MIPS32-NEXT:    jr $ra
28 ; MIPS32-NEXT:    nop
29 entry:
30   %cond = select i1 %test, i16 %a, i16 %b
31   ret i16 %cond
34 define i32 @select_i32(i1 %test, i32 %a, i32 %b) {
35 ; MIPS32-LABEL: select_i32:
36 ; MIPS32:       # %bb.0: # %entry
37 ; MIPS32-NEXT:    lui $1, 0
38 ; MIPS32-NEXT:    ori $1, $1, 1
39 ; MIPS32-NEXT:    and $1, $4, $1
40 ; MIPS32-NEXT:    movn $6, $5, $1
41 ; MIPS32-NEXT:    move $2, $6
42 ; MIPS32-NEXT:    jr $ra
43 ; MIPS32-NEXT:    nop
44 entry:
45   %cond = select i1 %test, i32 %a, i32 %b
46   ret i32 %cond
49 define i32* @select_ptr(i1 %test, i32* %a, i32* %b) {
50 ; MIPS32-LABEL: select_ptr:
51 ; MIPS32:       # %bb.0: # %entry
52 ; MIPS32-NEXT:    lui $1, 0
53 ; MIPS32-NEXT:    ori $1, $1, 1
54 ; MIPS32-NEXT:    and $1, $4, $1
55 ; MIPS32-NEXT:    movn $6, $5, $1
56 ; MIPS32-NEXT:    move $2, $6
57 ; MIPS32-NEXT:    jr $ra
58 ; MIPS32-NEXT:    nop
59 entry:
60   %cond = select i1 %test, i32* %a, i32* %b
61   ret i32* %cond
64 define i32 @select_with_negation(i32 %a, i32 %b, i32 %x, i32 %y) {
65 ; MIPS32-LABEL: select_with_negation:
66 ; MIPS32:       # %bb.0: # %entry
67 ; MIPS32-NEXT:    lui $1, 65535
68 ; MIPS32-NEXT:    ori $1, $1, 65535
69 ; MIPS32-NEXT:    slt $4, $4, $5
70 ; MIPS32-NEXT:    xor $1, $4, $1
71 ; MIPS32-NEXT:    lui $4, 0
72 ; MIPS32-NEXT:    ori $4, $4, 1
73 ; MIPS32-NEXT:    and $1, $1, $4
74 ; MIPS32-NEXT:    movn $7, $6, $1
75 ; MIPS32-NEXT:    move $2, $7
76 ; MIPS32-NEXT:    jr $ra
77 ; MIPS32-NEXT:    nop
78 entry:
79   %cmp = icmp slt i32 %a, %b
80   %lneg = xor i1 %cmp, true
81   %cond = select i1 %lneg, i32 %x, i32 %y
82   ret i32 %cond