PageRenderTime 132ms CodeModel.GetById 122ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/unmaintained/arm/4/4.factor

http://github.com/abeaumont/factor
Unknown | 45 lines | 39 code | 6 blank | 0 comment | 0 complexity | f6dfc3044ff1de2fd42311f0cf6e7149 MD5 | raw file
 1! Copyright (C) 2007 Slava Pestov.
 2! See http://factorcode.org/license.txt for BSD license.
 3USING: alien arrays cpu.architecture cpu.arm.assembler
 4cpu.arm.architecture cpu.arm5.assembler kernel kernel.private
 5math math.private namespaces sequences words quotations
 6byte-arrays hashtables.private hashtables generator
 7generator.registers generator.fixup sequences.private
 8strings.private ;
 9IN: cpu.arm4
10
11: (%char-slot)
12    "out" operand string-offset MOV
13    "out" operand dup "n" operand 2 <LSR> ADD ;
14
15\ char-slot [
16    (%char-slot)
17    "out" operand "obj" operand "out" operand <+> LDRH
18    "out" operand dup %tag-fixnum
19] H{
20    { +input+ { { f "n" } { f "obj" } } }
21    { +scratch+ { { f "out" } } }
22    { +output+ { "out" } }
23} define-intrinsic
24
25\ set-char-slot [
26    "val" operand dup %untag-fixnum
27    (%char-slot)
28    "val" operand "obj" operand "out" operand <+> STRH
29] H{
30    { +input+ { { f "val" } { f "n" } { f "obj" } } }
31    { +scratch+ { { f "out" } } }
32    { +clobber+ { "val" } }
33} define-intrinsic
34
35\ alien-signed-1 [ LDRSB ]
36\ set-alien-signed-1 [ STRB ]
37define-alien-integer-intrinsics
38
39\ alien-unsigned-2 [ LDRH ]
40\ set-alien-unsigned-2 [ STRH ]
41define-alien-integer-intrinsics
42
43\ alien-signed-2 [ LDRSH ]
44\ set-alien-signed-2 [ STRH ]
45define-alien-integer-intrinsics