Home | History | Annotate | Download | only in XCore
      1 ; RUN: llc -march=xcore < %s | FileCheck %s
      2 
      3 declare i32 @llvm.xcore.int.p1i8(i8 addrspace(1)* %r)
      4 declare i32 @llvm.xcore.inct.p1i8(i8 addrspace(1)* %r)
      5 declare i32 @llvm.xcore.testct.p1i8(i8 addrspace(1)* %r)
      6 declare i32 @llvm.xcore.testwct.p1i8(i8 addrspace(1)* %r)
      7 declare i32 @llvm.xcore.getts.p1i8(i8 addrspace(1)* %r)
      8 declare void @llvm.xcore.outt.p1i8(i8 addrspace(1)* %r, i32 %value)
      9 declare void @llvm.xcore.outct.p1i8(i8 addrspace(1)* %r, i32 %value)
     10 declare void @llvm.xcore.chkct.p1i8(i8 addrspace(1)* %r, i32 %value)
     11 declare void @llvm.xcore.setpt.p1i8(i8 addrspace(1)* %r, i32 %value)
     12 
     13 define i32 @int(i8 addrspace(1)* %r) nounwind {
     14 ; CHECK-LABEL: int:
     15 ; CHECK: int r0, res[r0]
     16 ; CHECK-NEXT: retsp 0
     17 	%result = call i32 @llvm.xcore.int.p1i8(i8 addrspace(1)* %r)
     18 	%trunc = and i32 %result, 255
     19 	ret i32 %trunc
     20 }
     21 
     22 define i32 @inct(i8 addrspace(1)* %r) nounwind {
     23 ; CHECK-LABEL: inct:
     24 ; CHECK: inct r0, res[r0]
     25 ; CHECK-NEXT: retsp 0
     26 	%result = call i32 @llvm.xcore.inct.p1i8(i8 addrspace(1)* %r)
     27 	%trunc = and i32 %result, 255
     28 	ret i32 %trunc
     29 }
     30 
     31 define i32 @testct(i8 addrspace(1)* %r) nounwind {
     32 ; CHECK-LABEL: testct:
     33 ; CHECK: testct r0, res[r0]
     34 ; CHECK-NEXT: retsp 0
     35 	%result = call i32 @llvm.xcore.testct.p1i8(i8 addrspace(1)* %r)
     36 	%trunc = and i32 %result, 1
     37 	ret i32 %trunc
     38 }
     39 
     40 define i32 @testwct(i8 addrspace(1)* %r) nounwind {
     41 ; CHECK-LABEL: testwct:
     42 ; CHECK: testwct r0, res[r0]
     43 ; CHECK-NEXT: retsp 0
     44 	%result = call i32 @llvm.xcore.testwct.p1i8(i8 addrspace(1)* %r)
     45 	%trunc = and i32 %result, 7
     46 	ret i32 %trunc
     47 }
     48 
     49 define i32 @getts(i8 addrspace(1)* %r) nounwind {
     50 ; CHECK-LABEL: getts:
     51 ; CHECK: getts r0, res[r0]
     52 ; CHECK-NEXT: retsp 0
     53 	%result = call i32 @llvm.xcore.getts.p1i8(i8 addrspace(1)* %r)
     54 	%trunc = and i32 %result, 65535
     55 	ret i32 %result
     56 }
     57 
     58 define void @outt(i8 addrspace(1)* %r, i32 %value) nounwind {
     59 ; CHECK-LABEL: outt:
     60 ; CHECK-NOT: zext
     61 ; CHECK: outt res[r0], r1
     62 ; CHECK-NEXT: retsp 0
     63 	%trunc = and i32 %value, 255
     64 	call void @llvm.xcore.outt.p1i8(i8 addrspace(1)* %r, i32 %trunc)
     65 	ret void
     66 }
     67 
     68 define void @outct(i8 addrspace(1)* %r, i32 %value) nounwind {
     69 ; CHECK-LABEL: outct:
     70 ; CHECK-NOT: zext
     71 ; CHECK: outct res[r0], r1
     72 	%trunc = and i32 %value, 255
     73 	call void @llvm.xcore.outct.p1i8(i8 addrspace(1)* %r, i32 %trunc)
     74 	ret void
     75 }
     76 
     77 define void @chkct(i8 addrspace(1)* %r, i32 %value) nounwind {
     78 ; CHECK-LABEL: chkct:
     79 ; CHECK-NOT: zext
     80 ; CHECK: chkct res[r0], r1
     81 	%trunc = and i32 %value, 255
     82 	call void @llvm.xcore.chkct.p1i8(i8 addrspace(1)* %r, i32 %trunc)
     83 	ret void
     84 }
     85 
     86 define void @setpt(i8 addrspace(1)* %r, i32 %value) nounwind {
     87 ; CHECK-LABEL: setpt:
     88 ; CHECK-NOT: zext
     89 ; CHECK: setpt res[r0], r1
     90 	%trunc = and i32 %value, 65535
     91 	call void @llvm.xcore.setpt.p1i8(i8 addrspace(1)* %r, i32 %trunc)
     92 	ret void
     93 }
     94