Re: 請問MMX與GCC C & ASM的問題

看板ASM (組合語言)作者 (雪地中的雁子)時間18年前 (2007/05/24 15:27), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/4 (看更多)
※ 引述《zxvc (zxvc)》之銘言: : 最近作專題要編譯一個程式: : http://iie.fing.edu.uy/investigacion/grupos/gmm/proyectos/tararira/ingles.php3 : 不過這程式是用C語言與x86指令寫的, : 這程式的原作者似乎是用gcc 3編譯的。 : 可是我手邊的機器多是用gcc 4, : 結果編譯的時候出現一堆問題,我試著看看自己有沒有能力修正。 : 之前也沒有用過MMX與GCC C & ASM,只在MASM上寫過一點x86。 : 我現在遇到一個問題, : 就是以下我自己寫的一個小程式為什麼無法用gcc編譯成功呢? : 我的編譯器是gcc 4.0.3,編譯的時候出現這個錯誤: : gcc test.c -mmmx : test.c: In function 'main': : test.c:9: error: impossible register constraint in 'asm' : test.c:15: confused by earlier errors, bailing out : ~~~~~~~~~~~~~~~~~~~ test.c ~~~~~~~~~~~~~~~~~~~~ : #include <stdlib.h> : #include <stdio.h> : int main () : { : double a, b; : a = 5.0; : b = 0.0; : asm ( : "movq %1, %0 \n\t" : : "=y" (b) : : "m" (a)); : printf ("Hello world.: %6.2f\n", b); : return 0; : } : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ : 『: "=y" (b)』那一行我是參考這篇文章設定的: : http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Machine-Constraints.html#Machine-Constraints : 或者縮減網址: : http://0rz.tw/ce2AA : 希望有高手能幫我解答,謝謝。 __asm{movq xmm0,temp_int} 請問當我在用 intel inline assembly 時, 編譯到這一行時, .net 會出現 "不合法的資料型態"的錯誤類別 改成 __asm{movq mm0,temp_int} 時就可以正確運作 這是由於 xmm0 是浮點數暫存器的關係嗎? 如果是,那要怎麼使用 SSE 的指令呢?(xmm0 ~ xmm7 都不能用嗎?) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.92.60.143

05/25 02:19, , 1F
movq不是SSE指令 是MMX和SSE2指令
05/25 02:19, 1F
文章代碼(AID): #16LJv7hC (ASM)
討論串 (同標題文章)
本文引述了以下文章的的內容:
以下文章回應了本文
完整討論串 (本文為第 2 之 4 篇):
文章代碼(AID): #16LJv7hC (ASM)