Subject: GCC assembly of my bittest.c

From: [email-masked] (Paul D. Smith)
Date: 11 Dec 1997 14:55:15 -0500

OK, I got gas compiled on my SunOS system.  The assembly generated by
GCC is almost exactly the same in each case.

Note that all of these were compiled without any optimization.

  73:bittest.c     ****     bit_win.Iconified = 1;
  43              	LM2:
  44 000c 11000000 		sethi %hi(_bit_win),%o0
  45 0010 D2022000 		ld [%o0+%lo(_bit_win)],%o1
  46 0014 15000020 		sethi %hi(32768),%o2
  47 0018 9212400A 		or %o1,%o2,%o1
  48 001c D2222000 		st %o1,[%o0+%lo(_bit_win)]

  75:bittest.c     ****     bit_win.Iconified = 0;
  50              	LM3:
  51 0020 11000000 		sethi %hi(_bit_win),%o0
  52 0024 D2022000 		ld [%o0+%lo(_bit_win)],%o1
  53 0028 173FFFDF 		sethi %hi(-32769),%o3
  54 002c 9412E3FF 		or %o3,%lo(-32769),%o2
  55 0030 920A400A 		and %o1,%o2,%o1
  56 0034 D2222000 		st %o1,[%o0+%lo(_bit_win)]

  77:bittest.c     ****     bit_win.t36 = 1;
  58              	LM4:
  59 0038 11000000 		sethi %hi(_bit_win),%o0
  60 003c 92102004 		mov 4,%o1
  61 0040 94122000 		or %o0,%lo(_bit_win),%o2
  62 0044 9002400A 		add %o1,%o2,%o0
  63 0048 D2020000 		ld [%o0],%o1
  64 004c 15040000 		sethi %hi(268435456),%o2
  65 0050 9212400A 		or %o1,%o2,%o1
  66 0054 D2220000 		st %o1,[%o0]

  79:bittest.c     ****     bit_win.t36 = 0;
  68              	LM5:
  69 0058 11000000 		sethi %hi(_bit_win),%o0
  70 005c 92102004 		mov 4,%o1
  71 0060 94122000 		or %o0,%lo(_bit_win),%o2
  72 0064 9002400A 		add %o1,%o2,%o0
  73 0068 D2020000 		ld [%o0],%o1
  74 006c 173BFFFF 		sethi %hi(-268435457),%o3
  75 0070 9412E3FF 		or %o3,%lo(-268435457),%o2
  76 0074 920A400A 		and %o1,%o2,%o1
  77 0078 D2220000 		st %o1,[%o0]

For the multi-int method:

  87:bittest.c     ****     old_win.flag1 |= OLD_ICONIFIED;
  83              	LM7:
  84 0084 11000000 		sethi %hi(_old_win),%o0
  85 0088 13000000 		sethi %hi(_old_win),%o1
  86 008c D4026000 		ld [%o1+%lo(_old_win)],%o2
  87 0090 9212A002 		or %o2,2,%o1
  88 0094 D2222000 		st %o1,[%o0+%lo(_old_win)]

  89:bittest.c     ****     old_win.flag1 &= ~OLD_ICONIFIED;
  90              	LM8:
  91 0098 11000000 		sethi %hi(_old_win),%o0
  92 009c 13000000 		sethi %hi(_old_win),%o1
  93 00a0 D4026000 		ld [%o1+%lo(_old_win)],%o2
  94 00a4 920ABFFD 		and %o2,-3,%o1
  95 00a8 D2222000 		st %o1,[%o0+%lo(_old_win)]

  91:bittest.c     ****     old_win.flag2 |= OLD_T36;
  97              	LM9:
  98 00ac 11000000 		sethi %hi(_old_win),%o0
  99 00b0 92102004 		mov 4,%o1
 100 00b4 94122000 		or %o0,%lo(_old_win),%o2
 101 00b8 9002400A 		add %o1,%o2,%o0
 102 00bc 13000000 		sethi %hi(_old_win+4),%o1
 103 00c0 D4026000 		ld [%o1+%lo(_old_win+4)],%o2
 104 00c4 9212A008 		or %o2,8,%o1
 105 00c8 D2220000 		st %o1,[%o0]

  93:bittest.c     ****     old_win.flag2 &= ~OLD_T36;
 107              	LM10:
 108 00cc 11000000 		sethi %hi(_old_win),%o0
 109 00d0 92102004 		mov 4,%o1
 110 00d4 94122000 		or %o0,%lo(_old_win),%o2
 111 00d8 9002400A 		add %o1,%o2,%o0
 112 00dc 13000000 		sethi %hi(_old_win+4),%o1
 113 00e0 D4026000 		ld [%o1+%lo(_old_win+4)],%o2
 114 00e4 920ABFF7 		and %o2,-9,%o1
 115 00e8 D2220000 		st %o1,[%o0]

For the array with macros method:

 101:bittest.c     ****     SET_FLAG(array_win.flags, ARRAY_ICONIFIED);
 122              	LM12:
 123 00f8 11000000 		sethi %hi(_array_win),%o0
 124 00fc 13000000 		sethi %hi(_array_win),%o1
 125 0100 D4026000 		ld [%o1+%lo(_array_win)],%o2
 126 0104 9212A002 		or %o2,2,%o1
 127 0108 D2222000 		st %o1,[%o0+%lo(_array_win)]

 103:bittest.c     ****     RESET_FLAG(array_win.flags, ARRAY_ICONIFIED);
 129              	LM13:
 130 010c 11000000 		sethi %hi(_array_win),%o0
 131 0110 13000000 		sethi %hi(_array_win),%o1
 132 0114 D4026000 		ld [%o1+%lo(_array_win)],%o2
 133 0118 920ABFFD 		and %o2,-3,%o1
 134 011c D2222000 		st %o1,[%o0+%lo(_array_win)]

 105:bittest.c     ****     SET_FLAG(array_win.flags, ARRAY_T36);
 136              	LM14:
 137 0120 11000000 		sethi %hi(_array_win),%o0
 138 0124 92102004 		mov 4,%o1
 139 0128 94122000 		or %o0,%lo(_array_win),%o2
 140 012c 9002400A 		add %o1,%o2,%o0
 141 0130 13000000 		sethi %hi(_array_win+4),%o1
 142 0134 D4026000 		ld [%o1+%lo(_array_win+4)],%o2
 143 0138 9212A008 		or %o2,8,%o1
 144 013c D2220000 		st %o1,[%o0]

 107:bittest.c     ****     RESET_FLAG(array_win.flags, ARRAY_T36);
 146              	LM15:
 147 0140 11000000 		sethi %hi(_array_win),%o0
 148 0144 92102004 		mov 4,%o1
 149 0148 94122000 		or %o0,%lo(_array_win),%o2
 150 014c 9002400A 		add %o1,%o2,%o0
 151 0150 13000000 		sethi %hi(_array_win+4),%o1
 152 0154 D4026000 		ld [%o1+%lo(_array_win+4)],%o2
 153 0158 920ABFF7 		and %o2,-9,%o1
 154 015c D2220000 		st %o1,[%o0]

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
     These are my opinions--Bay Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].