Last change
on this file since 85 was
81,
checked in by rosiere, 16 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:keywords set to
Id
|
File size:
2.2 KB
|
Rev | Line | |
---|
[2] | 1 | /******************************************** |
---|
| 2 | * files : asm_003_extend.s |
---|
| 3 | * authors : Rosiere Mathieu |
---|
| 4 | * date : 2006/06/20 |
---|
| 5 | ******************************************** |
---|
| 6 | * input : - |
---|
| 7 | * output : 1 test OK |
---|
| 8 | * 0 test KO |
---|
| 9 | ******************************************** |
---|
| 10 | * test : l.extbs, l.extbz, l.exthz, l.exths |
---|
| 11 | * warning : instruction ok |
---|
| 12 | * l.addi |
---|
| 13 | * l.and |
---|
| 14 | * l.jal |
---|
| 15 | * l.jr |
---|
| 16 | * l.lwz |
---|
| 17 | * l.ori |
---|
| 18 | * l.sw |
---|
| 19 | ******************************************** |
---|
| 20 | */ |
---|
| 21 | .file "asm_003_extend.s" |
---|
| 22 | .section .text |
---|
| 23 | .align 4 |
---|
| 24 | |
---|
| 25 | .global _asm_003_extend |
---|
| 26 | _asm_003_extend : |
---|
| 27 | /* save context */ |
---|
| 28 | l.addi r1,r1,-12 |
---|
| 29 | l.sw 0 (r1),r20 |
---|
| 30 | l.sw 4 (r1),r21 |
---|
| 31 | l.sw 8 (r1),r22 |
---|
| 32 | /* Return is KO (default)*/ |
---|
| 33 | l.and r11,r0,r0 |
---|
| 34 | |
---|
| 35 | /* WARNING : gcc don't compile if l.extXX have not two source register */ |
---|
| 36 | |
---|
| 37 | /* step 1 : test extend byte */ |
---|
| 38 | |
---|
| 39 | /* step 1.1 : test with a variable not signed */ |
---|
| 40 | |
---|
| 41 | l.ori r20,r0,0x007F |
---|
| 42 | |
---|
| 43 | l.extbz r22,r20 |
---|
| 44 | l.sfeq r22,r20 |
---|
| 45 | l.bnf _asm_003_extend_ko |
---|
| 46 | l.nop 1 |
---|
| 47 | |
---|
| 48 | l.extbs r22,r20 |
---|
| 49 | l.sfeq r22,r20 |
---|
| 50 | l.bnf _asm_003_extend_ko |
---|
| 51 | l.nop 2 |
---|
| 52 | |
---|
| 53 | /* step 1.2 : test with a varibale signed */ |
---|
| 54 | l.ori r20,r0,0x0080 |
---|
| 55 | |
---|
| 56 | l.movhi r21,0xFFFF |
---|
| 57 | l.ori r21,r21,0xFF80 |
---|
| 58 | |
---|
| 59 | l.extbz r22,r20 |
---|
| 60 | l.sfeq r22,r20 |
---|
| 61 | l.bnf _asm_003_extend_ko |
---|
| 62 | l.nop 3 |
---|
| 63 | |
---|
| 64 | l.extbs r22,r20 |
---|
| 65 | l.sfeq r22,r21 |
---|
| 66 | l.bnf _asm_003_extend_ko |
---|
| 67 | l.nop 4 |
---|
| 68 | |
---|
| 69 | /* step 2 : test extend half word */ |
---|
| 70 | |
---|
| 71 | /* step 2.1 : test with a variable not signed */ |
---|
| 72 | |
---|
| 73 | l.ori r20,r0,0x7FFF |
---|
| 74 | |
---|
| 75 | l.exthz r22,r20 |
---|
| 76 | l.sfeq r22,r20 |
---|
| 77 | l.bnf _asm_003_extend_ko |
---|
| 78 | l.nop 5 |
---|
| 79 | |
---|
| 80 | l.exths r22,r20 |
---|
| 81 | l.sfeq r22,r20 |
---|
| 82 | l.bnf _asm_003_extend_ko |
---|
| 83 | l.nop 6 |
---|
| 84 | |
---|
| 85 | /* step 2.2 : test with a variable signed */ |
---|
| 86 | l.ori r20,r0,0x8000 |
---|
| 87 | |
---|
| 88 | l.movhi r21,0xFFFF |
---|
| 89 | l.ori r21,r21,0x8000 |
---|
| 90 | |
---|
| 91 | l.exthz r22,r20 |
---|
| 92 | l.sfeq r22,r20 |
---|
| 93 | l.bnf _asm_003_extend_ko |
---|
| 94 | l.nop 7 |
---|
| 95 | |
---|
| 96 | l.exths r22,r20 |
---|
| 97 | l.sfeq r22,r21 |
---|
| 98 | l.bnf _asm_003_extend_ko |
---|
| 99 | l.nop 8 |
---|
| 100 | |
---|
| 101 | _asm_003_extend_ok : |
---|
| 102 | l.addi r11,r0,1 |
---|
| 103 | _asm_003_extend_ko : |
---|
| 104 | |
---|
| 105 | /* load context */ |
---|
| 106 | l.lwz r22,8 (r1) |
---|
| 107 | l.lwz r21,4 (r1) |
---|
| 108 | l.lwz r20,0 (r1) |
---|
| 109 | l.jr r9 |
---|
| 110 | l.addi r1,r1,12 |
---|
Note: See
TracBrowser
for help on using the repository browser.