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 i32 @sub_i32(i32 %x, i32 %y) {
5 ; MIPS32-LABEL: sub_i32:
6 ; MIPS32: # %bb.0: # %entry
7 ; MIPS32-NEXT: subu $2, $4, $5
15 define signext i8 @sub_i8_sext(i8 signext %a, i8 signext %b) {
16 ; MIPS32-LABEL: sub_i8_sext:
17 ; MIPS32: # %bb.0: # %entry
18 ; MIPS32-NEXT: subu $1, $5, $4
19 ; MIPS32-NEXT: sll $1, $1, 24
20 ; MIPS32-NEXT: sra $2, $1, 24
28 define zeroext i8 @sub_i8_zext(i8 zeroext %a, i8 zeroext %b) {
29 ; MIPS32-LABEL: sub_i8_zext:
30 ; MIPS32: # %bb.0: # %entry
31 ; MIPS32-NEXT: subu $1, $5, $4
32 ; MIPS32-NEXT: ori $2, $zero, 255
33 ; MIPS32-NEXT: and $2, $1, $2
41 define i8 @sub_i8_aext(i8 %a, i8 %b) {
42 ; MIPS32-LABEL: sub_i8_aext:
43 ; MIPS32: # %bb.0: # %entry
44 ; MIPS32-NEXT: subu $2, $5, $4
52 define signext i16 @sub_i16_sext(i16 signext %a, i16 signext %b) {
53 ; MIPS32-LABEL: sub_i16_sext:
54 ; MIPS32: # %bb.0: # %entry
55 ; MIPS32-NEXT: subu $1, $5, $4
56 ; MIPS32-NEXT: sll $1, $1, 16
57 ; MIPS32-NEXT: sra $2, $1, 16
65 define zeroext i16 @sub_i16_zext(i16 zeroext %a, i16 zeroext %b) {
66 ; MIPS32-LABEL: sub_i16_zext:
67 ; MIPS32: # %bb.0: # %entry
68 ; MIPS32-NEXT: subu $1, $5, $4
69 ; MIPS32-NEXT: ori $2, $zero, 65535
70 ; MIPS32-NEXT: and $2, $1, $2
78 define i16 @sub_i16_aext(i16 %a, i16 %b) {
79 ; MIPS32-LABEL: sub_i16_aext:
80 ; MIPS32: # %bb.0: # %entry
81 ; MIPS32-NEXT: subu $2, $5, $4
89 define i64 @sub_i64(i64 %a, i64 %b) {
90 ; MIPS32-LABEL: sub_i64:
91 ; MIPS32: # %bb.0: # %entry
92 ; MIPS32-NEXT: subu $2, $6, $4
93 ; MIPS32-NEXT: sltu $1, $6, $4
94 ; MIPS32-NEXT: subu $3, $7, $5
95 ; MIPS32-NEXT: ori $4, $zero, 1
96 ; MIPS32-NEXT: and $1, $1, $4
97 ; MIPS32-NEXT: subu $3, $3, $1
101 %sub = sub i64 %b, %a
105 define i128 @sub_i128(i128 %a, i128 %b) {
106 ; MIPS32-LABEL: sub_i128:
107 ; MIPS32: # %bb.0: # %entry
108 ; MIPS32-NEXT: addiu $1, $sp, 16
109 ; MIPS32-NEXT: lw $1, 0($1)
110 ; MIPS32-NEXT: addiu $2, $sp, 20
111 ; MIPS32-NEXT: lw $2, 0($2)
112 ; MIPS32-NEXT: addiu $3, $sp, 24
113 ; MIPS32-NEXT: lw $3, 0($3)
114 ; MIPS32-NEXT: addiu $8, $sp, 28
115 ; MIPS32-NEXT: lw $8, 0($8)
116 ; MIPS32-NEXT: subu $9, $1, $4
117 ; MIPS32-NEXT: sltu $1, $1, $4
118 ; MIPS32-NEXT: subu $4, $2, $5
119 ; MIPS32-NEXT: ori $10, $zero, 1
120 ; MIPS32-NEXT: and $11, $1, $10
121 ; MIPS32-NEXT: subu $4, $4, $11
122 ; MIPS32-NEXT: xor $11, $2, $5
123 ; MIPS32-NEXT: sltiu $11, $11, 1
124 ; MIPS32-NEXT: sltu $2, $2, $5
125 ; MIPS32-NEXT: and $5, $11, $10
126 ; MIPS32-NEXT: movn $2, $1, $5
127 ; MIPS32-NEXT: subu $1, $3, $6
128 ; MIPS32-NEXT: and $5, $2, $10
129 ; MIPS32-NEXT: subu $1, $1, $5
130 ; MIPS32-NEXT: xor $5, $3, $6
131 ; MIPS32-NEXT: sltiu $5, $5, 1
132 ; MIPS32-NEXT: sltu $3, $3, $6
133 ; MIPS32-NEXT: and $5, $5, $10
134 ; MIPS32-NEXT: movn $3, $2, $5
135 ; MIPS32-NEXT: subu $2, $8, $7
136 ; MIPS32-NEXT: and $3, $3, $10
137 ; MIPS32-NEXT: subu $5, $2, $3
138 ; MIPS32-NEXT: move $2, $9
139 ; MIPS32-NEXT: move $3, $4
140 ; MIPS32-NEXT: move $4, $1
141 ; MIPS32-NEXT: jr $ra
144 %sub = sub i128 %b, %a