LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 13199 - clang doesn't support Y-prefixed asm constraints
Summary: clang doesn't support Y-prefixed asm constraints
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: Frontend (show other bugs)
Version: 3.1
Hardware: PC All
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
: 32727 (view as bug list)
Depends on:
Blocks: 10988
  Show dependency tree
 
Reported: 2012-06-25 06:54 PDT by Valery Khromov
Modified: 2017-11-19 06:29 PST (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Valery Khromov 2012-06-25 06:54:39 PDT
$ cat 1.c 
#include <inttypes.h>

static uint64_t y = 0x123456789ABCDEF0ULL;

int
main()
{
	register uint64_t x;
	asm volatile ( "movq %1, %0" : "=Yz"(x) : "m"(y) );

	return 0;
}

$ cc -O0 -ggdb -Wall -W -mssse3 -m64 1.c -o 1

$ objdump -d 1
...
0000000000400530 <main>:
  400530:	55                   	push   %rbp
  400531:	48 89 e5             	mov    %rsp,%rbp
  400534:	f3 0f 7e 05 a4 00 10 	movq   1048740(%rip),%xmm0        # 5005e0 <y>
  40053b:	00 
  40053c:	b8 00 00 00 00       	mov    $0x0,%eax
  400541:	c9                   	leaveq 
  400542:	c3                   	retq   
...

$ clang -O0 -ggdb -Wall -W -mssse3 -m64 1.c -o 1
1.c:9:33: error: invalid output constraint '=Yz' in asm
        asm volatile ( "movq %1, %0" : "=Yz"(x) : "m"(y) );
                                       ^
1 error generated.

$ cc --version
cc (GCC) 4.2.2 20070831 prerelease [FreeBSD]
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ clang --version
clang version 3.1 (trunk)
Target: amd64-portbld-freebsd8.2
Thread model: posix
Comment 1 Valery Khromov 2012-06-25 07:01:23 PDT
From http://gcc.gnu.org/svn/gcc/trunk/gcc/config/i386/constraints.md :

;; We use the Y prefix to denote any number of conditional register sets:
;;  z	First SSE register.
;;  i	SSE2 inter-unit moves enabled
;;  m	MMX inter-unit moves enabled
;;  a	Integer register when zero extensions with AND are disabled
;;  p	Integer register when TARGET_PARTIAL_REG_STALL is disabled
;;  d	Integer register when integer DFmode moves are enabled
;;  x	Integer register when integer XFmode moves are enabled

Looks like clang doesn't support any of Y-prefixed constraints.
Comment 2 Ted Kremenek 2012-06-25 14:23:25 PDT
cloned to <rdar://problem/11741367>
Comment 3 Simon Pilgrim 2017-04-21 03:05:16 PDT
*** Bug 32727 has been marked as a duplicate of this bug. ***