Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!ccu.umanitoba.ca!herald.usask.ca!alberta!ubc-cs!uw-beaver!cornell!charney From: charney@cs.cornell.edu (Mark Charney) Newsgroups: comp.sys.mips Subject: double -> int Message-ID: <1991Jun12.172740.22629@cs.cornell.edu> Date: 12 Jun 91 17:27:40 GMT Sender: news@cs.cornell.edu (USENET news user) Organization: Cornell Univ. CS Dept, Ithaca NY 14853 Lines: 79 Originator: charney@turing4.cs.cornell.edu Nntp-Posting-Host: turing4.cs.cornell.edu Can someone give me the documentation for trunc.w.d? I'm trying to figure out what is going on with DOUBLE->INT conversion on my mips chip. I've included a C program, the associated assembly language file and a dissassembly. Thanks, Mark Charney charney@cs.cornell.edu --------------------------------------------------------- main() { double a=5; int c; c = (int) a ; } --------------------------------------------------------- .verstamp 2 10 .text .align 2 .file 2 "con.c" .globl main .loc 2 2 # 1 main() # 2 { .ent main 2 main: .option O1 subu $sp, 16 .frame $sp, 16, $31 .loc 2 3 # 3 double a=5; li.d $f4, 5.0000000000000000e+00 s.d $f4, 8($sp) .loc 2 5 # 4 int c; # 5 c = (int) a ; trunc.w.d $f6, $f4, $14 swc1 $f6, 4($sp) .loc 2 6 # 6 } move $2, $0 addu $sp, 16 j $31 .end main --------------------------------------------------------- --------------------------------------------------------- (I think the meaning of lines starting with "x" is clear. The others seem to be associated with trunc.w.d.) MAIN: [con.c: 5] 0x4001b0: 444ef800 cfc1 t6,$31 [con.c: 5] 0x4001b4: 444ef800 cfc1 t6,$31 x [con.c: 3] 0x4001b8: c7848010 lwc1 $f4,-32752(gp) x [con.c: 3] 0x4001bc: c7858014 lwc1 $f5,-32748(gp) [con.c: 5] 0x4001c0: 35c10003 ori at,t6,0x3 [con.c: 5] 0x4001c4: 38210002 xori at,at,0x2 [con.c: 5] 0x4001c8: 44c1f800 ctc1 at,$31 x [con.c: 2] 0x4001cc: 27bdfff0 addiu sp,sp,-16 [con.c: 5] 0x4001d0: 462021a4 cvt.w.d $f6,$f4 x [con.c: 3] 0x4001d4: e7a40008 swc1 $f4,8(sp) x [con.c: 5] 0x4001d8: e7a60004 swc1 $f6,4(sp) [con.c: 5] 0x4001dc: 44cef800 ctc1 t6,$31 x [con.c: 3] 0x4001e0: e7a5000c swc1 $f5,12(sp) x [con.c: 6] 0x4001e4: 27bd0010 addiu sp,sp,16 x [con.c: 6] 0x4001e8: 03e00008 jr ra x [con.c: 6] 0x4001ec: 00001021 move v0,zero ---------------------------------------------------------