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
15 %cond = select i1 %test, i8 %a, i8 %b
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
30 %cond = select i1 %test, i16 %a, i16 %b
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
45 %cond = select i1 %test, i32 %a, i32 %b
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
60 %cond = select i1 %test, i32* %a, i32* %b
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
79 %cmp = icmp slt i32 %a, %b
80 %lneg = xor i1 %cmp, true
81 %cond = select i1 %lneg, i32 %x, i32 %y