1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s
3 ; Test that basic 32-bit integer operations assemble as expected.
5 target datalayout = "E-m:e-p:32:32-i64:64-a:0:32-n32-S64"
6 target triple = "lanai"
8 ; Function Attrs: nounwind readnone
9 declare i32 @llvm.ctpop.i32(i32) #1
11 ; Function Attrs: nounwind readnone
12 declare i32 @llvm.ctlz.i32(i32, i1) #1
14 ; Function Attrs: nounwind readnone
15 declare i32 @llvm.cttz.i32(i32, i1) #1
18 ; CHECK: add %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
19 define i32 @add32(i32 %x, i32 %y) {
25 ; CHECK: sub %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
26 define i32 @sub32(i32 %x, i32 %y) {
33 define i32 @mul32(i32 %x, i32 %y) {
38 ; CHECK-LABEL: sdiv32:
40 define i32 @sdiv32(i32 %x, i32 %y) {
45 ; CHECK-LABEL: udiv32:
47 define i32 @udiv32(i32 %x, i32 %y) {
52 ; CHECK-LABEL: srem32:
54 define i32 @srem32(i32 %x, i32 %y) {
59 ; CHECK-LABEL: urem32:
61 define i32 @urem32(i32 %x, i32 %y) {
67 ; CHECK: and %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
68 define i32 @and32(i32 %x, i32 %y) {
74 ; CHECK: or %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
75 define i32 @or32(i32 %x, i32 %y) {
81 ; CHECK: xor %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
82 define i32 @xor32(i32 %x, i32 %y) {
88 ; CHECK: sh %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
89 define i32 @shl32(i32 %x, i32 %y) {
95 ; CHECK: sub %r0, %r{{[0-9]+}}, %r{{[0-9]+}}
96 ; CHECK: sh %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
97 define i32 @shr32(i32 %x, i32 %y) {
103 ; CHECK: sub %r0, %r{{[0-9]+}}, %r{{[0-9]+}}
104 ; CHECK: sha %r{{[0-9]+}}, %r{{[0-9]+}}, %rv
105 define i32 @sar32(i32 %x, i32 %y) {
110 ; CHECK-LABEL: clz32:
111 ; CHECK: leadz %r{{[0-9]+}}, %rv
112 define i32 @clz32(i32 %x) {
113 %a = call i32 @llvm.ctlz.i32(i32 %x, i1 false)
117 ; CHECK-LABEL: clz32_zero_undef:
119 ; CHECK: leadz %r{{[0-9]+}}, %rv
120 define i32 @clz32_zero_undef(i32 %x) {
121 %a = call i32 @llvm.ctlz.i32(i32 %x, i1 true)
125 ; CHECK-LABEL: ctz32:
126 ; CHECK: trailz %r{{[0-9]+}}, %rv
127 define i32 @ctz32(i32 %x) {
128 %a = call i32 @llvm.cttz.i32(i32 %x, i1 false)
132 ; CHECK-LABEL: ctz32_zero_undef:
134 ; CHECK: trailz %r{{[0-9]+}}, %rv
135 define i32 @ctz32_zero_undef(i32 %x) {
136 %a = call i32 @llvm.cttz.i32(i32 %x, i1 true)
140 ; CHECK-LABEL: popcnt32:
141 ; CHECK: popc %r{{[0-9]+}}, %rv
142 define i32 @popcnt32(i32 %x) {
143 %a = call i32 @llvm.ctpop.i32(i32 %x)