SAN FRANCISCO -- Sirf Technology ( SIRF) posted a large loss in the second quarter, as hefty writedowns and weak demand took a toll on the troubled chipmaker. Sirf said its gross margin was cut in half to 21%, compared with 42.6% in the first quarter. "This was a challenging quarter for Sirf with weakness in demand from our OEM and ODM customers, especially in the portable navigation device space, and continued competitive pressures that impacted both our revenue and margins," Sirf said in a statement. Shares of Sirf fell more than 15% in recent after-hours trading to $3.57. The San Jose, Calif., maker of GPS chips posted a loss of $332.6 million, or $5.41 a share, in the second quarter, compared with a profit of $2.1 million, or 4 cents, at this time last year. Sirf said the loss included a $215.7 million goodwill impairment charge, as well as some $90 million in special charges for items including impairment to acquisition-related intangibles and note receivables, as well as income tax provisions and stock compensation expenses. Excluding most items, but including $10.3 million in stock compensation expense, the company lost 19 cents a share. Using current share counts, the company lost 29 cents a share excluding stock expense; analysts polled by Thomson Reuters were expecting a 28-cent-a-share loss on that basis. Sales in the three months ended June 30 totaled $63.1 million, compared with $70.6 million at this time last year. The average analyst expectation was $62 million. In response to the difficult conditions, Sirf said it will make further cuts to its workforce, with plans to lay off 7% to 9% of its employees by the end of September, while reprioritizing certain engineering projects. The company said it is seeing "good design win traction" with its newer products but remains cautious in its outlook because of economic uncertainties and competitive challenges. Sirf did not provide specific financial guidance for the third quarter but is scheduled to hold a conference call discussing its results with analysts on Thursday.