• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: XCode 2.2.1 / gcc 4.0 Peephole Bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode 2.2.1 / gcc 4.0 Peephole Bug


  • Subject: Re: XCode 2.2.1 / gcc 4.0 Peephole Bug
  • From: Ben Weiss <email@hidden>
  • Date: Wed, 19 Apr 2006 01:46:30 -0700

All right, so I tried it in assembly, and ran into another bug (I think):

Given the function:

static int duplicatelabelbug(register vector unsigned short a, register vector unsigned short b) {
register vector unsigned short vmask;

asm { vcmpgtuh. vmask, a, b; beq cr6, mylabel; };
asm { vcmpgtuh. vmask, b, a; beq cr6, mylabel; }; // <-- duplicate label??

return 0;

mylabel: return 1; // <-- label only defined once, here!
}


XCode 2.2.1 / gcc 4.0 generates: "error: duplicate label 'LASM $mylabel' " even though the label "mylabel" is only defined once. (CodeWarrior handles this code just fine.) Is this a gcc bug?

Ben

On Apr 19, 2006, at 1:09 AM, Ben Weiss wrote:

Given the Altivec function:

vector unsigned short peepholebug(vector unsigned short a, vector unsigned short b) {
vector unsigned short mask = (vector unsigned short)vec_cmplt(a, b);

if (vec_all_ge(a, b)) return a;

return mask;
}


XCode 2.2.1 / gcc 4.0 generates ( with optimizer set to -os):

mfspr r0,256
stw r0,-8(r1)
oris r0,r0,0x8000
mtspr 256,r0
vcmpgtuh. v0,v3,v2
vcmpgtuh v0,v3,v2
beq cr6,L99
vor v2,v0,v0
lwz r12,-8(r1)
mtspr 256,r12
blr

Note the second "vcmpgtuh" instruction, which is completely superfluous. The peephole optimizer should recognize this situation and remove the instruction. (I've filed a bug with Apple; #4519214.) Anyone know if more recent versions of gcc are able to do this? I have some bottleneck code that could seriously benefit from this, and I'd rather avoid assembly if I can...

Thanks,
Ben
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40benweiss.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: XCode 2.2.1 / gcc 4.0 Peephole Bug
      • From: Olivier Tristan <email@hidden>
References: 
 >Undefined constants from pch (From: Steve Mills <email@hidden>)
 >XCode 2.2.1 / gcc 4.0 Peephole Bug (From: Ben Weiss <email@hidden>)

  • Prev by Date: XCode 2.2.1 / gcc 4.0 Peephole Bug
  • Next by Date: Re: XCode 2.2.1 / gcc 4.0 Peephole Bug
  • Previous by thread: XCode 2.2.1 / gcc 4.0 Peephole Bug
  • Next by thread: Re: XCode 2.2.1 / gcc 4.0 Peephole Bug
  • Index(es):
    • Date
    • Thread