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 33741 - llvm does not support loopw/loopl
Summary: llvm does not support loopw/loopl
Status: NEW
Alias: None
Product: tools
Classification: Unclassified
Component: TableGen (show other bugs)
Version: trunk
Hardware: PC Linux
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
: 33737 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-07-11 01:00 PDT by Paolo Bonzini
Modified: 2017-07-11 08:17 PDT (History)
2 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 Paolo Bonzini 2017-07-11 01:00:54 PDT
LLVM supports jcxz/jecxz, but doesn't allow overriding the register used by the 'loop' instruction.

// compile with:
//    clang -m32 test-loopw.c -O2 -o test-loopw
//
// expected output:
//    0xffff0000

#include <stdlib.h>
#include <stdio.h>

int main()
{
  unsigned x = 0xffff1234;
  // Intel syntax:
  //     asm volatile("1: addr16 loop 1b" : "+c" (x));
  asm volatile("1: loopw 1b" : "+c" (x));
  printf("%x\n", x);
  exit (x == 0xffff0000 ? 0 : 1);
}

This seems to affect the disassembler as well.  The above program is disassembled like this:

Disassembly of section .text:
main:
 ...
 8048354:	89 d9 	movl	%ebx, %ecx
 8048356:	67 e2 fd 	loop	-3
 ...
Comment 1 tblodt 2017-07-11 08:17:35 PDT
*** Bug 33737 has been marked as a duplicate of this bug. ***